yegor256/rultor

Time.parse() ignores GMT and trailing Z, so iso() round-trip drifts by JVM offset

Open

#2,359 opened on Jun 9, 2026

 (1 comment) (0 reactions) (0 assignees)Java (165 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (575 stars)
PR merge metrics
 (PR metrics pending)

Description

src/main/java/com/rultor/Time.java, iso() at lines 66-71 and parse(String) at lines 86-93.

iso() formats the millis in GMT and emits a trailing Z. parse(String) builds a SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US) and never calls setTimeZone, so the parser interprets the input in the JVM default time zone. SimpleDateFormat.parse is also lenient about trailing characters, so the Z written by iso() is silently dropped and never enforced. The result is that new Time(new Time(msec).iso()).msec() differs from msec by the JVM offset on every host where the default zone is not GMT/UTC.

The daemon round-trips through these two methods on every build: started and ended are written via iso() into the talk XML and read back via new Time(string) in EndsRequest and elsewhere, so the elapsed-time numbers exposed to users are wrong by the offset on any non-UTC host, and the wall-clock columns shown on the website are wrong by the same offset.

Smallest fix in parse(String): mirror iso() by setting the parser to GMT and including the 'Z' literal in the pattern, or replace the body with Instant.parse(date).toEpochMilli() and have the constructor accept a String keep the same throw contract via DateTimeParseException.

Contributor guide