Jump to content
Light-O-Rama Forums

BL05 v4.3.0 Visualizer time running backwards

Recommended Posts

On 11/22/2015 at 2:45 PM, PhilMassey said:

One Little Mistake.........................


This was the testing code I left in:


If -1 < 0 then


Right above it was the correct line commented out:


If TimeGetTIme() < 0 then



For those of you who were wondering....  


Yes, time can run backwards.  Well, not really.  What happens is that after 24 1/2 days or so the clock counter rolls over into bit 32.  That is important since the last bit (which may actually be the first bit, or the ... well..... don't EVEN get me going on little endian big endian twos compliment crud) in some languages is the SIGN bit.  That is, if bit 32 = 1 this is a negative number.  That's the way it is in the Visualizer - we have SIGNED doubles (32 bit numbers).  The problem is that TImeGetTime returns an UNSIGNED double.  


So here comes 24 1/2 days + 1 mS.  TIme Get Time will now return 2147483648 as the current counter.  In Binary that is 10000000 00000000 00000000 00000001.  Thanks to the way Twos Compliment works along with the signed variable, unsigned value, that turns into an insanely huge negative number.  Subsequent calls will now show the value getting BIGGER (less negative, but still negative).  Time is now running backwards.


Can I code around that?  Sure I could.  But frankly, after 24 and 1/2 days you really SHOULD reboot the beast! ;)


(or at least something close.  I'm too tired to go look up exact numbers and binary reps.  You get the idea.)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...