Converting System Clock to Epoch

Hey does anyone know how to convert GS system clock variables into epoch? I need to convert it to epoch so I can use it in my game.

Maybe someone has a different method to determine if 3+ hours has passed since a saved time without the game being on?

Although I haven't tested it, just using the date and time from the GS device clock won't work very well without reconverting it back to epoch right? If it is in epoch I would just need to have something like game.SavedTime+180 to have it determine if 3 hours passed. As it is now if I did something like hour+3 it wouldn't work. If the time was saved at 11pm that value would have reset in the next day screwing it up right? Same for day month and year. So that is why all these values would be needed to be converted into one long number (epoch).

Just wondering if anyone has come up with a good solid method to utilize this. I haven't seen anything on GS, but how to use it for a clock.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    I spent a lot of time wrestling with this and have a template available that measures time passed since last using the app (either in background mode or completely quit out of). It's for sale but is based off of the OS Time Demo that is freely available (but does not measure time outside of the active app).

    You can click the Templates link in my signature to find out more about it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FallacyStudiosFallacyStudios Member Posts: 970
    Hey @tatiang

    Thanks I'll look into both of those.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You're welcome. Here's the OS Time Demo.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.