A Binary Clock
Posted on July 29th, 2009 by Jeffrey

Okok, I’ll admit to it.  Last week I was looking at ThinkGeek and browsing their selection of entertaining curio and oddities — when I came across a binary clock. I had seen these before, thought they were neat – but not quite neat enough to drop 50 bucks on. And my wife wouldn’t let it in the house anyway.  So I decided to break out flash and see if I could build one.  I thought it would be rather easy and, low and behold it was.  You can check it out here.

Flash has had this handy dandy secret back from AS1 days that allows you to pass a radix parameter to the toString() function.  So all I had to do was break up hours, minutes and seconds into arrays and convert each number toString(2) and check to see if it was a one or zero.  Ahh, if only these binary clocks displayed time in a true binary format — but they don’t. I guess 32bit systems are way beyond current clock technology.  Actually, for ease of readability (really?) of a binary time system, it displays in this format called BCD, or binary coded decimal, where each digit gets its own display column.  So more arrays to split, but still basically the same principle.

I’m sure there are better ways to do this — I just thought I’d share my evening’s adventure.  BTW here is the source.

Office Banter
Projects
Creative Culture
Snippets

Leave a Reply

Join the conversation. Share your thoughts, complaints or praises.

It’s easy: just submit your name and email address.
Don’t worry, we won’t publish your email.

URL not required—use http://