Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbTimer() across multiple computers

Author
Message
Crimson X
16
Years of Service
User Offline
Joined: 28th Nov 2007
Location: New Hampshire
Posted: 11th Dec 2007 23:39 Edited at: 11th Dec 2007 23:44
Really simple question from me today
When making use of dbTimer(), do the results vary between different computers? If they do, is there a better timer to use that will return the same results? Thanks!

For example:


In order for hunger to decrease by only one, I need to call it in that 20 (nanosecond?) cycle. Any higher and it will decrease by more. But if someone has a faster computer, could it possible decrease more in the 20 second span?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Dec 2007 14:40
Quote: "do the results vary between different computers?"

Yes - dbTimer returns the number of milliseconds since windows boot time.
Quote: "
If they do, is there a better timer to use that will return the same results?"

Not a timer as such - Instead of using the timer as an absolute value, use the difference between then and now instead. Your example code, using a snapshot of the start time is how you do this.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th Dec 2007 15:36
Note - I forget who - maybe it was calcyman or something - uses a API call or something to get even more finite - or more accurate - closer to real time - but personally - I find IanM's comment dead on and more than adequate. Maybe on a super FAST FAST machine - those claims that "more accurate is better" would have merit - but for me - if I was on that fast a machine - I would just make the code "Wait" for at least a milli second to pass before doing my next set of calculated motion etc on the screen.

dbTimer works Great!

Login to post a reply

Server time is: 2024-11-17 00:59:26
Your offset time is: 2024-11-17 00:59:26