Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
Ubuntu Gutsy Gibbon
Description
import org.joda.time.DateTime import static org.joda.time.DateTimeZone class EWUtils { static DateTime nowUTC() { return new DateTime(UTC) } } //Inside a test case import static EWUtils.nowUTC ... DateTime baseDate = nowUTC() println "${baseDate.minusWeeks(1)} ${baseDate.minusWeeks(1).millis}" println "${nowUTC().minusWeeks(1)} ${nowUTC().minusWeeks(1).millis}" // The output 2008-04-16T18:40:09.698Z 1208371209698 2008-04-16T18:40:09.709Z 1208976009709
The second println statement demonstrates the bug. The epoch time is approximately equal to the current time instead of being a week old as in the first example.
The bug only manifests when nowUTC() belongs to another class - if I move it into the same class as the test it's OK