Atomic Powered QL

Author(s): John Pazmino
Publication: LISTing Newsletter
Date: April 1988
Pages: 8, 7

You can get a soup-can sized module that furnishes unlimited eternal power for … No, you can’t! However, your QL’s onboard timer can be set from the United States naval Observatory atomic clock.

The builtin timer ticks off the seconds from powerup, and is accessible from BASIC as the string function DATE$. Printing DATE$ displays the date and time on the screen and many programs can read this string to “stamp” datafiles with the instant date and hour. While you can set this timer from BASIC, the necessarily approximate time you key in may be too inprecise for some applications.

The USNO runs a dialup digital clock service on 202-653-0351, 1200b, 7E1 or 8N1, all hours. When you acquire the connection with the service there is no logon process. It immediately starts sending down the wire once each second a coded string giving the instant Coordinated Universal Time (UTC). The time resolution is only to whole seconds, but for virtually any legal or commercial matter this is thoroly adequate. Also there is a transmission delay in the phone grid of up to 300 milliseconds and the massaging of the UTC string, once captured by your computer, does occupy a few more milliseconds.

Assuming the captured UTC string is “47178 018 032954 UTC” it is laid out is follows:

char 1 to 5      the lower five digits of the Julian Day Number. the
                 full JDN is this number plus 2400000.5. ["47178", JDN
                 is 2447178.5]

char 7 to 9      the number of the day within the year, from 1 to 365 or
                 366. ["018", date is 18 January]

char 11 to 16    the hour, minute, second of UTC, with no separators.
                 ["032945", UTC is 03h 29m 54s]

char 18 to 20    the letters "UTC" for "Universal Time, Coordinated"

char 6, 10, 17   space, blank

Do not run your regular comms program for altho you will see the UTC string fired to the screen second by second there is no quick simple way to grab one into a BASIC variable for adjusting the system timer. Write and run a plain-vanilla BASIC terminal program as illustrated below.

The call to the digital clock is timed to disconnect after one minute. This is entirely sufficient time to capture one UTC string and hangup the phone; you’ll be billed for a one-minute long distance call to Washington. The modem is fitted to the QL “SER2” port in the usual configuration.

  2 INPUT "4-digit year, month number, day, 0-24 hour"; year,month,day,hour
10 BAUD 1200: OPEN#3,ser2e
20 PRINT#3,"ATDP12026530351"
30 INPUT#3,utc$: IF LEN(utc$)<>20 THEN GO TO 30
40 SDATE year,month,day,hour,utc$(13 TO 14),utc$(15 TO 16)
50 PRINT DATE$
60 PRINT#3,"ATH"
70 STOP

2: Collect the date and time for SDATE; the minutes and seconds will be captured later from the digital clock.

10: Open channel #3 to the SER2 port at 1200bps, even parity. Some particular QL setups may falter at 1200bps in BASIC. Because the USNO transmits only at 1200bps you’ll have to try it out. You should succede on the QL with a compiled copy of the program.

20: Send out the dialup signal. The one here is for a Hayes modem; substitute your own modem’s dialup signal.

30: Read channel #3 for the UTC string and test that it reasonably is the real string and not a modem report or other spurious signal.

40: Adjust the system timer from utc$. The QL DATE$ is set thru the command SDATE. This uses the items collected in line 2, plus the minutes and seconds sliced out of utc$.

50: For satisfaction’s sake print out the reset DATE$.

60: Send out the hangup signal to terminate the call.

70: Terminate the program.

Remember that DATE$ is lost on powerdown and you have to call USNO to reset them at the start of each session. If your rig has a self-powered clock-calendar chip installed you can call USNO once, reset DATE$, and then reset the chip from the timer.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.