Well, sometimes lastModified does not increase. This is a temporary resolution, and in each file system the resolution is different:
- all
FAT (FAT32, FAT16, FAT12) have a temporary resolution of 2 second , - for
NTFS it is 100 ns (yep, nanoseconds) - for most * nixes its
1 second .
So, if your files change quickly, lastModified will not change, and your monitor may lose some changes.
This is also very difficult, because if you have the same file on different file systems (for example, FAT32 and NTFS), their lastModified time will differ due to different time resolutions. Now because of this, you can react to fake changes to files that were not there - it's just FAT32 , which returns a time that is 1 second different from NTFS time. This also applies to web servers - if you do not know the file system of the server, then you do not know what temporary resolution matters in the HTTP header.
The workaround is to assume that the file has not changed if the difference between the saved value and the FS value is less than 3-4 seconds. This is what WebStart does when checking for new versions of JAR files on the server.
source share