| 1 |
package align2; |
| 2 |
|
| 3 |
import java.io.File; |
| 4 |
|
| 5 |
import fileIO.ReadWrite; |
| 6 |
import shared.Parse; |
| 7 |
import shared.Tools; |
| 8 |
|
| 9 |
public class PrintTime { |
| 10 |
|
| 11 |
public static void main(String[] args){ |
| 12 |
long millis=System.currentTimeMillis(); |
| 13 |
|
| 14 |
if(args==null || args.length<1){ |
| 15 |
System.err.println("Time:\t"+millis); |
| 16 |
} |
| 17 |
|
| 18 |
if(args!=null && args.length>0){ |
| 19 |
File f=new File(args[0]); |
| 20 |
if(f.exists()){ |
| 21 |
String s=ReadWrite.readString(args[0]); |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
long old=Long.parseLong(s); |
| 26 |
long elapsed=millis-old; |
| 27 |
if(args.length<2 || Parse.parseBoolean(args[1])){ |
| 28 |
System.out.println("Elapsed:\t"+Tools.format("%.2f", elapsed/1000d)); |
| 29 |
if(true){ |
| 30 |
System.err.println("Elapsed:\t"+Tools.format("%.2f", elapsed/1000d)); |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
f=null; |
| 35 |
ReadWrite.writeString(millis+"", args[0]); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
} |