stevel 2005/04/07 10:07:34
Modified: src/main/org/apache/tools/ant Diagnostics.java
Log:
[EMAIL PROTECTED] my junit reports are apparently an hour old. No fix, but
-diagnostics now prints some clock info, and examines diffs between temp dir
and local clock and complains if they are too different. (>10s, purely
arbitrary)
Revision Changes Path
1.25 +26 -0 ant/src/main/org/apache/tools/ant/Diagnostics.java
Index: Diagnostics.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Diagnostics.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Diagnostics.java 11 Mar 2005 11:10:30 -0000 1.24
+++ Diagnostics.java 7 Apr 2005 17:07:33 -0000 1.25
@@ -30,6 +30,8 @@
import java.io.FileOutputStream;
import java.util.Enumeration;
import java.util.Properties;
+import java.util.Calendar;
+import java.util.TimeZone;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
@@ -238,6 +240,9 @@
header(out, "Temp dir");
doReportTempDir(out);
+
+ header(out, "Locale information");
+ doReportLocale(out);
out.println();
}
@@ -390,6 +395,7 @@
/**
* try and create a temp file in our temp dir; this
* checks that it has space and access.
+ * We also do some clock reporting.
* @param out
*/
private static void doReportTempDir(PrintStream out) {
@@ -406,6 +412,7 @@
return;
}
//create the file
+ long now=System.currentTimeMillis();
File tempFile=null;
FileOutputStream fileout = null;
try {
@@ -418,8 +425,14 @@
}
fileout.close();
fileout=null;
+ long filetime=tempFile.lastModified();
tempFile.delete();
out.println("Temp dir is writeable");
+ long drift=filetime-now;
+ out.println("temp dir alignment with system clock is "+drift+"
ms");
+ if(drift>10000) {
+ out.println("Warning: big clock drift -maybe a network
filesystem");
+ }
} catch (IOException e) {
out.println("Failed to create a temporary file in the temp dir "
+ tempdir);
@@ -430,6 +443,19 @@
tempFile.delete();
}
}
+ }
+
+ /**
+ * Report locale information
+ * @param out
+ */
+ private static void doReportLocale(PrintStream out) {
+ //calendar stuff.
+ Calendar cal = Calendar.getInstance();
+ TimeZone tz = cal.getTimeZone();
+ long now = System.currentTimeMillis();
+ out.println("Timezone "+tz.getDisplayName()
+ + " offset="+tz.getOffset(now));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]