ElapsedMilliseconds() gets negative
Posted: Wed May 21, 2014 10:02 pm
Introduced in Windows 8, turning your computer off will actually put it into some kind of hibernation mode. That's great because it'll help to shut down and boot much faster!
Anyway, if you've read the title you know that this is not why I started this thread. Instead I wanted to let you know what I just found out: ElapsedMilliseconds() isn't very reliable anymore, because it will not be reset when turning you computer off - instead only when restarting it.
Technically this might even be correct behavior. However on the user side it's kind of strange to see statistics (e.g. the Task Manager) telling me that my computer is on for 20 days although I just turned it on a couple of hours ago.
The problem: Since PureBasic is only returning a signed long variable for ElapsedMilliseconds() things can get weird if the computer is "on" for about 24 days. Here and there I'm using a little code to check if a certain delay has passed:Starting with Windows 8 chances are way higher that this code will fail because after 24 days ElapsedMilliseconds() will return a negative value...
Obviously it would be great if ElapsedMilliseconds() could just return a quad value (which will be safe for the next 290 million years
). But apart from that are there any quick fixes for my problem?
Anyway, if you've read the title you know that this is not why I started this thread. Instead I wanted to let you know what I just found out: ElapsedMilliseconds() isn't very reliable anymore, because it will not be reset when turning you computer off - instead only when restarting it.
Technically this might even be correct behavior. However on the user side it's kind of strange to see statistics (e.g. the Task Manager) telling me that my computer is on for 20 days although I just turned it on a couple of hours ago.
The problem: Since PureBasic is only returning a signed long variable for ElapsedMilliseconds() things can get weird if the computer is "on" for about 24 days. Here and there I'm using a little code to check if a certain delay has passed:
Code: Select all
If ElapsedMilliseconds() > LastTime + 1000 ; At least 1 sec passed?
LastTime = ElapsedMilliseconds()
; [...]
Obviously it would be great if ElapsedMilliseconds() could just return a quad value (which will be safe for the next 290 million years
