Okay, I've thought I had this figured out before but nothing seems to correctly measure the time away (time where game is not playing versus time game is playing) for an "idle" feature I want to include in a game I am building.
The idea: I want players to gain Turns and regen Health when the game is not running.
The best I can come up with: Find a way to record the current time recorded as a global variable before game is saved (using the Unix epoch measure of time in ticks) and subtract that from the current time which is recorded as a global variable (using same measure of time) when a player logs in and loads the saved game. From there it would just be a matter of dividing the remained by the ratio I want to increase Turns and Health by.
The problem: I can't for the life of me find the correct way to pull the measure of time (Unix epoch measure in ticks) and I am not sure that is the best way to do it.
I want to avoid adding another plug-in to my game, so I'm hoping for a native way to do this.
Any thoughts?