From f50a31c74c4e8bd83e5f14fc0acd5c67c969b43a Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Thu, 19 Apr 2012 14:05:39 +0400 Subject: [PATCH] TimeUtils --- .../tests/org/jetbrains/jet/TimeUtils.java | 27 +++++++++++++++++++ .../ForTestCompileSomething.java | 7 ++--- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 compiler/tests/org/jetbrains/jet/TimeUtils.java diff --git a/compiler/tests/org/jetbrains/jet/TimeUtils.java b/compiler/tests/org/jetbrains/jet/TimeUtils.java new file mode 100644 index 00000000000..646ee9eaf96 --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/TimeUtils.java @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet; + +/** + * @author Stepan Koltsov + */ +public class TimeUtils { + + public static String millisecondsToSecondsString(long millis) { + return millis / 1000 + "." + String.format("%03d", millis % 1000); + } +} diff --git a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java index 69d46985ce0..174ffe669dc 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java +++ b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java @@ -21,6 +21,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.TimeUtils; import java.io.File; import java.io.FileOutputStream; @@ -70,16 +71,12 @@ abstract class ForTestCompileSomething { FileUtil.delete(classesDir); long end = System.currentTimeMillis(); - System.out.println("Compiling " + jarName + " done in " + millisecondsToSecondsString(end - start) + "s"); + System.out.println("Compiling " + jarName + " done in " + TimeUtils.millisecondsToSecondsString(end - start) + "s"); } catch (Throwable e) { error = e; } } - private static String millisecondsToSecondsString(long millis) { - return millis / 1000 + "." + String.format("%03d", millis % 1000); - } - private static void copyToJar(File root, JarOutputStream os) throws IOException { Stack> toCopy = new Stack>(); toCopy.add(new Pair("", root)); -- GitLab