What the limit of Millisecs ?
Monkey Forums/Monkey Programming/What the limit of Millisecs ?
| ||
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! |
| ||
i'm guessing it depends on the OS, and how the timer is kept. either 32-bit int or 64-bit long or ...?? |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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.) |
| ||
@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. |