Simple Binary Clock

Share your advanced PureBasic knowledge/code with the community.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Simple Binary Clock

Post by Kale »

Code updated for 5.20+

A very small snippet i was playing with and thought its quite cute. I may turn it into a full prog with nice UI :) Need to be a geek to read it though. :wink:

Code: Select all

Procedure CalculateTime()
  CurrentDate = Date()
  Hour = Hour(CurrentDate)
  Minute = Minute(CurrentDate)
  Second = Second(CurrentDate)
  ClearConsole()
  Print(RSet(Bin(Hour), 8, "0") + " : " + RSet(Bin(Minute), 8, "0") + " : " + RSet(Bin(Second), 8, "0"))
EndProcedure

OpenConsole()
EnableGraphicalConsole(#True)
CalculateTime()

StartTime = ElapsedMilliseconds()

Repeat
  ElapsedTime = ElapsedMilliseconds()
  
  If (ElapsedTime - StartTime) > 1000
    CalculateTime()
    StartTime = ElapsedMilliseconds()
  EndIf
ForEver
--Kale

Image
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

If you are going to use this way on a real clock, you need a widescreen led display :)

Sweet.
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

http://www.thinkgeek.com/cubegoodies/lights/59e0/

They have watches somewhere too 8)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Cool 8)

this thing has nothing to do with a binary clock, but its definantly cool:
http://www.thinkgeek.com/electronics/phones/5c83/
Post Reply