users@glassfish.java.net

Re: getLastModified is not working?

From: <glassfish_at_javadesktop.org>
Date: Fri, 08 Oct 2010 08:38:52 PDT

Ok, my fault.

The HTTP date headers have second precision while getLastModified has millisecond precision. Weird enough. I just need round it to seconds. Like this:

return tsInit / 1000 * 1000;

Actually I've found this piece of a book that explains exactly that!

http://oreilly.com/catalog/jservlet/chapter/ch03.html#14260

It's awesome as I've been using this technique for YEARS and never noticed that. Probably because most of the time I relied on timestamps of files which are usually second-precision already. It's never late to learn a new trick.
[Message sent by forum member 'sargue']

http://forums.java.net/jive/thread.jspa?messageID=484778