H
Harold Yarmouth
Calendar calendar = Calendar.getInstance();
calendar.set(2003,9,10,13,8,42);
Date date = calendar.getTime();
When the above code is run twice with some time passing in between, the
resulting Date objects compare unequal!
The getTime methods returned the following values from two runs of the
above code:
1065805722140
1065805722828
As you can see, the last three digits appear to vary randomly.
Clearly, this should not be the case. Calling calendar.set with the
maximal precision (six values) should completely determine the resulting
Date object. It looks like it uses the last three digits of the current
millisecond value of the system clock to "fill in the blanks" when it
really ought to use zeros.
calendar.set(2003,9,10,13,8,42);
Date date = calendar.getTime();
When the above code is run twice with some time passing in between, the
resulting Date objects compare unequal!
The getTime methods returned the following values from two runs of the
above code:
1065805722140
1065805722828
As you can see, the last three digits appear to vary randomly.
Clearly, this should not be the case. Calling calendar.set with the
maximal precision (six values) should completely determine the resulting
Date object. It looks like it uses the last three digits of the current
millisecond value of the system clock to "fill in the blanks" when it
really ought to use zeros.