So I've been programming a lot with the Love2D framework lately which is really nice to work with. However I was always afraid to start implementing timers in my programs with the love.timer.getTime() function, since it's described on the site as: "Returns the value of a precise timer with an unspecified starting time.". It's kinda straight foreward, but also a vague explaination. If it returns time from an unspecified starting point, does that also mean that at one point the timer can reset and return a new starting time? or will it always keep going?
I want to know this, because if I compare the difference in time, and it suddenly resets back to around 0, the comparison will be faulty.
Can anyone explain me how the inner mechanics of the timer work, and if it resets, and if yes, what to do about it.
love.timer.getTime() resets?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3172
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: love.timer.getTime() resets?
It always keeps going, you just always need to calculate the difference between a start and end time rather than assuming the time is always 0 at a certain point or whatever.*
* In love 11.4 it was changed to get set to 0 when the love.timer module is loaded. Before then, it was up to the OS (for example on some operating systems it would only be set to 0 when the computer is booted up.)
* In love 11.4 it was changed to get set to 0 when the love.timer module is loaded. Before then, it was up to the OS (for example on some operating systems it would only be set to 0 when the computer is booted up.)
Re: love.timer.getTime() resets?
It resets to 0 on the game starting only.
Re: love.timer.getTime() resets?
Thanks for th info!
Who is online
Users browsing this forum: Google [Bot] and 2 guests