intripoon
28th December 2009 21:35 UTC
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
kichik
30th December 2009 07:33 UTC
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.
intripoon
30th December 2009 11:51 UTC
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.
MSG
30th December 2009 12:21 UTC
Well then, why not just make your decision algorithm a little bit less picky? Make it "if dt > 123".
intripoon
30th December 2009 13:09 UTC
I already did that. But I'm still wondering why timestamp precision with 7z/lzma is higher than with nsis using 7z/lzma.
kichik
30th December 2009 13:44 UTC
NSIS doesn't use 7-zip which is the container that also saves timestamps. We only use lzma compression.
intripoon
30th December 2009 16:33 UTC
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?
kichik
31st December 2009 10:49 UTC
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.