Archive: File Timestamp Precision


File Timestamp Precision
Hi !

I'm the creator of a free game I distribute on my website www.walkover.org. Until now, I offered a simple 7z or selfextractor to distribute it. But lately, I realized that it's too complicated to get the game installed for some gamers. So I decided to replace it with an installer that creates a link on the desktop and in the startmenu. I managed to do this with NSIS by modifying an example.

But now I've got a problem: After the initial setup, there is an autoupdate system that updates the game to the most current version. This system relies on filestamps being correct - if they are not, it redownloads the file. Now comes the strange part: With 7z+selfextractor, the timestamps were correct after the installation, but with nsis and lzma - which is essentially the same I guess - the timestamps are slightly off. This makes my autoupdater redownload every file.

Is there a way to increase the file timestamp precision?

Best regards
Marc


Are you using NTFS or FAT? NTFS has more precise timestamps.

I have to mention that using timestamps for that is less than perfect. Other programs can easily change timestamps and so can users editing your files. You're much better off with proper version numbers.


It's perfectly fine to use timestamps for that. For example, rsync uses them as a hint as well - my patching works similar. So if some files have changed timestamps or just some got modified by the user, that's fine, they'll get patched to the correct version again on the next update run. This is only a problem if all timestamps get corrupted for all players - that would lead to everyone downloading everything again.


Well then, why not just make your decision algorithm a little bit less picky? Make it "if dt > 123".


I already did that. But I'm still wondering why timestamp precision with 7z/lzma is higher than with nsis using 7z/lzma.


NSIS doesn't use 7-zip which is the container that also saves timestamps. We only use lzma compression.


ic. How complicated would it be to modify the code to enhance the precision? Is it more a small change or does it affect the code at a lot of places?


Search for TOK_FILE in Source\script.cpp. I think it's in the function that's called there, near the end of the file.