@Mell's yes - it was all just about the precision of the returned value. The doc's said that os.timer() returns the current time in seconds - which normally is great if you want to display the current time to the nearest second, however it's not usually accurate enough for time critical applications, but considering the precision associated with this function - just multiplying the value (so it's in the millisecond range) is actually good enough.
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
just multiplying the value (so it's in the millisecond range) is actually good enough.
Actually you do not need to multiply anything -you get a small number (much less than 1) with some digits after the dot (or comma, depending on your locale) - the mentioned "precision" describes the number of digits you get. Multiply by 1000 only if you want to show it in miliseconds instead of seconds. And for microseconds, multiply by 1000000.
Yes but... sometimes it's easier to express your time in milliseconds rather than seconds - especially for timings, as 16ms is easier to read than 0.016 seconds
Actually - I do just use os.timer() without scaling it in my "old skool" demos and it does work fine
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Comments
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Multiply by 1000 only if you want to show it in miliseconds instead of seconds. And for microseconds, multiply by 1000000.
Actually - I do just use os.timer() without scaling it in my "old skool" demos and it does work fine
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill