What the limit of Millisecs ?

Monkey Forums/Monkey Programming/What the limit of Millisecs ?

Rushino(Posted 2013) [#1]
Hey guys,

:) As the topic say.. just wanted to know what is the limit of Millisecs ? What happen when this limit is reached.. does it get back to 0 ?

Thanks!


AdamRedwoods(Posted 2013) [#2]
i'm guessing it depends on the OS, and how the timer is kept. either 32-bit int or 64-bit long or ...??


dawlane(Posted 2013) [#3]
What happen when this limit is reached.. does it get back to 0
Yes. For 32 bit systems I believe it's will wrap round in about 49 days.


Goodlookinguy(Posted 2013) [#4]
Actually it'll be about half that. I'm pretty sure it's a signed integer, so around 25 days or so. After that it's negative numbers until it wraps back around to 0.

@Rushino

If you need bigger numbers or you're doing something like storing play time, may I suggest you take a look at my experimental numbers module. It's still in very heavy progress, as I pumped it out one day pretty quick, but it can add and subtract numbers via strings.


Rushino(Posted 2013) [#5]
I am storing a timer on a tile for animation purpose but i am probably do it wrong.... it work but consume a lots of space if there many tiles around plusbthey probably wont be sync at all. Look like i need something more global.


DruggedBunny(Posted 2013) [#6]
Depending on what you need to do with the timer, you may be able to use Floyd's advice in this post:

http://www.blitzbasic.com/Community/post.php?topic=84114&post=950040

(My solution in that thread, which was based on worrying about this very problem, would be no good as Monkey doesn't have long integers.)


Rushino(Posted 2013) [#7]
@DruggedBunny

Thanks dude based on this post ive been able to make a simple timer (not based on millisecs) class that i will attach a reference to my tilemap to handle tiles and objects animation.

In fact, i could make use of the Hz (ticks) to simulate a timer and use difference to compare and check if a second has been elapsed. If a second is elapsed it return true.. then wait another second before it return true again.

This system should work!

Thanks.