Re: Get GamePlaying Time
- Posted by Lone_EverGreen_Ranger Aug 27, 2011
- 1057 views
I am currently working on a RPG Game. I am trying to figure out how I would get the game playing time. As in seconds, minutes and hours. I have an idea, however I am puzzled as to how to go about it. Any examples would be appericated, if needed I can show my code. Below is my code. I have the variables, but I'm not sure how would I go about using them to get the game playing time. As I said any examples would be great.
The easiest thing is probably to note the start and stop times using now(), and then use diff(), which returns the number of seconds between the two. You can keep adding seconds for subsequent sessions, and then convert that sum as needed for display purposes.
Matt
Could I get a working example of that? It would be easier for me to figure out if I had a visual example.