Api: Timegettime() - timeGetTime() returns negative value

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Others

Api: Timegettime() - timeGetTime() returns negative value

Galahad
Ok, I have this weird problem, using timeGetTime() API. I'm using it in a small application, that shows current system up-time. Now, it has been working fine, but at some point, it started returning negative values, and it counts backwards (decrementing the value)...

I don't know if system uptime has anything to do with it; my system has been running for approximately 690 hours, and I first noticed a problem a few days back. Now, I know there is perfectly reasonable explanation for this, but it escapes me. I tried searching for this problem on the web, but had no success.

For example, timeGetTime() at some point started returning negative values: -2484000000, and counts down, to -2483999999, -2483999998, etc...

Is it just my comp freaking out, or Windows was not designed to run for so long? laugh.gif I don't want to restart it, but if that's the only way... smile.gif

Oh, btw, I'm using it inside Visual Basic app, but I would hope that has nothing to do with this weird problem biggrin.gif

Thanx in advance...

 

 

 


Reply

tzenes
This is a flaw in the windows timeGetTime function (not a bug), and is deterministic behaviour.

The windows SDK states:
QUOTE
Note that the value returned by the timeGetTime function is a DWORD value. The return value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days. This can cause problems in code that directly uses the timeGetTime return value in computations, particularly where the value is used to control code execution. You should always use the difference between two timeGetTime return values in computations.


so every ~50 days one of your counters will reset before the other does
and when you take the difference of the two you will get a negitive number.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. timegettime example - 5.17 hr back. (1)
  2. vb6 timegettime - 26.96 hr back. (1)
  3. timegettime sample с - 116.59 hr back. (1)
  4. how to when timegettime() reset - 150.46 hr back. (1)
  5. timegettime negative - 158.85 hr back. (1)
  6. timegettime api - 116.49 hr back. (2)
  7. timegettime() example - 203.88 hr back. (1)
  8. vb6 timegettime returns 0 - 219.64 hr back. (1)
  9. timegettime() tutorial - 239.72 hr back. (1)
  10. windows timegettime - 270.02 hr back. (1)
  11. timegettime - 75.58 hr back. (7)
  12. timegettime problems - 312.33 hr back. (1)
  13. using timegettime - 316.41 hr back. (1)
  14. timegettime vb6 - 317.97 hr back. (1)
Similar Topics

Keywords : api timegettime timegettime returns negative


    Looking for api, timegettime, timegettime, returns, negative

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for api, timegettime, timegettime, returns, negative

*MORE FROM TRAP17.COM*
advertisement



Api: Timegettime() - timeGetTime() returns negative value



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE