Hi,
I have a timestamp in my game.
It is a text object that counts down seconds, and when finished turns into a timestamp like that:
timetext.text = "Timer ended at:" .. "\n" .. os.date("%a %d-%m, %I:%M %p")
The way this works is every second the timer measures the difference between os.time() and a saved target value, say os.time()+10. When the former is greater than the latter the above code is executed and the timer is cancelled.
My function works also when the app is off, so upon launching it performs a check to see if it the timer has already passed its target. So again, if the new os.time() is greater than the saved value, it should display the timestamp.
The problem is, when I do the above it will display the current time. And I want it at the time the timer ended. So the best way to do this would be to caluclate the text beforehand and just display it when needed.
Something like
savedTimestampToDisplayLater = os.date("%a %d-%m, %I:%M %p") + 180 seconds
Possible?
EDIT: I’d like to avoid just doing os.time()+180 because it causes hoops to jump through to format as a timestamp.