Create and load a timestamp? (SOLVED)

I was wondering if anyone has done this. I’d like to add a timestamp to my save files (currently I just store the version number.) My save system leaves older save versions intact in case of some issue (so I can revert the player to a previous version save if something occurs.) When it loads, it then applies any update changes and resaves the game under the new version number as a separate file. However, I’d like to include also a timestamp in case the conversion itself leads to an issue. Then I can simply remove all saves before a certain time for the current version and the update process should run again from the old save data.

EDIT: I figured it out! Simply using the line:

savedata["prg_timestamp"] = os.time(os.date("!*t"))

in my save-game now includes the UNIX epoch time. Now I am able to do some comparisons.

3 Likes