Mumps-style “dotted do” notation example

FT                                      # A label (for jumping to)
  NEW X,MSG2
  I $$RDVALS^MISC22()=SUCCESS DO QUIT   # The second space between DO and QUIT is significant
  . S X="DO ACTN5^ACTNS"
  . X X                                 # The two Xs mean different things (Cache' is not a context-free language)
  . S MSG2=MSG_" succeeded."            # Expect MSG to float in from somewhere else
  E DO
  . S ERRMSG=INVALIDREADMSG
  . W 1/0

$H clock

Background

InterSystems Caché’s native datetime format is  days-since-12/31/1840 + comma + seconds-since-midnight. I call this $H format because it’s the format the the $H (short for $horolog) Caché system variable returns.

As an example,

03/27/2009 16:22:27

would translate to

61447,58947

in $H format.

What I Want

I want a $H clock.

  1. The clock should display the $H time in big LCD numbers, updated once per second.
  2. I’m thinking the clock would be about 3″ high by 8″ wide.
  3. I don’t want it to be attached to the computer or powered by the computer.  I can already display the $H time on the computer.  If the $H clock gets its time or power any way from a PC, the whole coolness factor for this is gone.
  4. Battery powered probably, but could be electric plug-in or solar powered, I don’t care so much as long as it’s not powered by a PC (see #3).
  5. If I build this myself, I’m willing to spend up to about $50 on materials because it will be so fun to attempt, but if someone else beats me to it I’m only willing to spend about $15 to buy their version.
  6. I have to be able to set the time somehow, preferably not by typing in a raw $H number (which I would have to look up on the computer -> detrimental to coolness factor -> see #3).
  7. I don’t care if it supports a 6-digit year value (that would be needed starting on 10/16/2114).  In fact, I’d probably rather it didn’t leave room for more than a 1 in the sixth column, as the extra space could make the display proportions look odd, detracting from the coolness factor.  (The coolness factor is very important to me. : )

Code

I expect there might need to be an IC chip to compute the $H datetime display from the current date and time.  Here’s some Python code that does the job, as an example:


# $horolog-style date/time.
from datetime import date,datetime

dateh = date.today() - date(1840,12,31)
now = datetime.now().time()
timeh = (now.hour * 60 + now.minute) * 60 + now.second
print str(dateh.days)+','+str(timeh)

def FromHorologFormat(horolog):
  parts = horolog.split(',')
  dateh = date(1840,12,13) + parts[0]
  timeh = parts[1]

  timeDec = timeh
  hours = timeDec / 60

def ToHorologFormat(dateParam, timeParam):
  dateh = dateParam - date(1840,12,31)
  timeh = (timeParam.hour * 60 + timeParam.minute) * 60 + timeParam.second
  print str(dateh.days)+','+str(timeh)

def currentHorolog():
  dateh = date.today() - date(1840,12,31)
  now = datetime.now().time()
  timeh = (now.hour * 60 + now.minute) * 60 + now.second
  print str(dateh.days)+','+str(timeh)

For an IC chip it might need to be done in C, but the Python could serve as pseudocode…