this.setLocation(200, 100); | this.setLocation(200, 100); | ||||
version_label.setText("Version: " + Version.text); | version_label.setText("Version: " + Version.text); | ||||
built_label.setText("Built: " + new Date(Version.time).toString()); | |||||
built_label.setText("Built: " + new Date(Version.getTime()).toString()); | |||||
addOptionsPanel(new BuildOptionsPanel()); | addOptionsPanel(new BuildOptionsPanel()); | ||||
loadOptions(); | loadOptions(); |
* time in seconds-since-... format, used by programmatic clients. | * time in seconds-since-... format, used by programmatic clients. | ||||
* (if DEVELOPMENT version, NOTIME) | * (if DEVELOPMENT version, NOTIME) | ||||
*/ | */ | ||||
public static final long time; | |||||
private static long time = -1; // -1 = uninitialized | |||||
/** format used by build script to set time_text */ | /** format used by build script to set time_text */ | ||||
public static final String SIMPLE_DATE_FORMAT = "EEEE MMM d, yyyy 'at' HH:mm:ss z"; | public static final String SIMPLE_DATE_FORMAT = "EEEE MMM d, yyyy 'at' HH:mm:ss z"; | ||||
// if not DEVELOPMENT version, read time text using format used to set time | |||||
static { | |||||
long foundTime = NOTIME; | |||||
try { | |||||
SimpleDateFormat format = new SimpleDateFormat(SIMPLE_DATE_FORMAT); | |||||
ParsePosition pos = new ParsePosition(0); | |||||
Date date = format.parse(time_text, pos); | |||||
foundTime = date.getTime(); | |||||
} catch (Throwable t) { | |||||
} | |||||
time = foundTime; | |||||
public static long getTime() { | |||||
if (time==-1) { | |||||
long foundTime = NOTIME; | |||||
// if not DEVELOPMENT version, read time text using format used to set time | |||||
try { | |||||
SimpleDateFormat format = new SimpleDateFormat(SIMPLE_DATE_FORMAT); | |||||
ParsePosition pos = new ParsePosition(0); | |||||
Date date = format.parse(time_text, pos); | |||||
if (date!=null) foundTime = date.getTime(); | |||||
} catch (Throwable t) { | |||||
} | |||||
time = foundTime; | |||||
} | |||||
return time; | |||||
} | } | ||||
/** | /** |
public void testVersion() { | public void testVersion() { | ||||
if (Version.time_text.equals("")) return; // dev build, we can only test this on the build server. | if (Version.time_text.equals("")) return; // dev build, we can only test this on the build server. | ||||
Date date = new Date(Version.time); | |||||
Date date = new Date(Version.getTime()); | |||||
SimpleDateFormat format = new SimpleDateFormat(Version.SIMPLE_DATE_FORMAT, Locale.getDefault()); | SimpleDateFormat format = new SimpleDateFormat(Version.SIMPLE_DATE_FORMAT, Locale.getDefault()); | ||||
format.setTimeZone(TimeZone.getTimeZone("GMT")); | format.setTimeZone(TimeZone.getTimeZone("GMT")); | ||||
String timeString = format.format(date); | String timeString = format.format(date); |
public void write(DataOutputStream s) throws IOException { | public void write(DataOutputStream s) throws IOException { | ||||
s.writeShort(CURRENT_VERSION_MAJOR); | s.writeShort(CURRENT_VERSION_MAJOR); | ||||
s.writeShort(CURRENT_VERSION_MINOR); | s.writeShort(CURRENT_VERSION_MINOR); | ||||
s.writeLong(Version.time); // build used to construct the class... | |||||
s.writeLong(Version.getTime()); // build used to construct the class... | |||||
} | } | ||||
public static WeaverVersionInfo read(VersionedDataInputStream s) throws IOException { | public static WeaverVersionInfo read(VersionedDataInputStream s) throws IOException { |