This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [patch] Fix java.util.zip.ZipEntry.setTime
Tom Tromey writes:
> >>>>> "Jerry" == Jerry Quinn <jlquinn@optonline.net> writes:
>
> Jerry> Currently, setTime mangles the time by scaling, constructing dostime,
> Jerry> then unscaling dostime. The scaling is unnecessary.
>
> Could you expand on that a bit?
>
> My understanding is that DOS stores time in seconds, whereas Date
> wants milliseconds. Hence the scaling and unscaling.
The code looked like:
setTime(long time)
{
...
new Date(time * 1000)
}
However, setTime is defined to take a value in milliseconds, and Date
is also. Multiplying by 1000 screwed up the Date that was constructed
and things go downhill from there.
Check out the mauve test case
gnu/testlet/java/util/zip/ZipEntry/time.java.
>
> Jerry> - dostime = (int) (dostime / 1000L);
>
> It seems like this line ought to be within the `synchronized'
> statement.
This line goes away (I hope :-)
Jerry