Usno.rexx (c) 1989 Steve Poling. Freely distributable to all, keep it that way. Kudos, to Jeremy Farrance who provided critical sections of code to make usno.rexx work in all situations. Usno.rexx was written by Steve Poling as an excercize in AREXX programming. The date of this release 1.0 28 aug 89. You may not find this program terribly useful if: - You have no interest in AREXX - You don't own Baud Bandit (it might be converted to VLT, idunno) - You refuse to tolerate another program that does what AtomClock does. (AtomClock is a Modula-2 program (I haven't seen source) that also calls the Naval Observatory. See section Usno vs AtomClock for more.) Being something of an astronomy buff I was aware of the US Naval Observatory's (USNO) various contribution to amateur astronomy for us computerized folk. One of the services of USNO is to distribute accurate time codes. If you call 1(202)653-0351, a USNO computer will answer and it will send a series of pairs of lines of the form: jjjjj ddd hhmmss UTC * The actual output is not Js, Xs, etc. but digits. The meaning of those digits is as follows: jjjjj stands for the 5 least significant digits of the Julian date. ddd stands for the number of days since Jan 1st of this year. hhmmss stands for the Hours Minutes Seconds of right now The UTC indicates that they aren't talking Washington DC clock-on-the-wall time. The UTC is roughly the same as GMT or Zulu give or take a leap second or two, I think. Note that if the USNO changes their format, their phone number or their baud rate, this program will have to change. This is my first rexx program so please be gentle in criticism. Many times I was confronted with problems, and the only solution I could find was an ugly, brute force solution. I hope that some kind soul will view this code with compassion, and show me a better way to do some of these things. (Jeremy was the first such benefactor.) I will enumerate the problems and I will incorporate your suggestions in subsequent releases of Usno.rexx. - I never did get DIAL to work, I couldn't tell which BaudBandit commands returned status codes or not. Frustrating as heck. - I had a SEND command, but no way to GET chars directly from port as I wanted. Had to resort to a RAM file capture. PULL didn't do what I wanted. Many thanks belong to Art Steinmetz who's program I studied while writing this one. (I didn't have source, I saw how it ran.) More thanks belong to Jeremy Farrance who offered helpful suggestions and then Jeremy took my pre-release code and improved it drastically. Finally thanks go to Jean Meeus who's book Astronomical Formulae for Calculators provided the algorithm for Julian to calendar date conversion. AtomClock VS Usno.rexx You are probably wondering how Usno.rexx fits into the eternal scheme of things. Expecially since the problem is already, essentially solved. I don't think of the two programs as being competitors. Each serves a different purpose: Usno - to teach ME rexx and program interfacing. PERIOD. It sets the the clock, too. Maybe teach you something, too? AtomClock - to set the amigados system clock, and whatever else Art Steinmetz wanted from it. Relative strengths: AtomClock - Workbench support. Critical variables are held in the tooltypes of the icon, where they can be easily modified. This is a superior approach. I'll bet AtomClock is more accurate and faster. AtomClock is compiled, to it takes less core, etc. Usno.rexx - has none of those things. The USNO phone number, its baud rate, the modem control stuff are all hard-coded in the rexx source. I considered putting in stuff to read those params out of an icon file, but hey, the language is interpreted. Everyone's got the source, people can read comments, they can change it themselves w/o too much hassle. I just saved myself the programming to do all that stuff unrelated to the primary mission of USNO.REXX. You'll note that unlike AtomClock, usno.rexx sets the date and year. I leave as an excercize to the student: Modify USNO.REXX to set the system hardware clock after it sets AmigaDog's time. LAST WORD: (At last!) I've also provided for your pleasure the programs Julian.rexx and DeJulian.rexx. These programs do Julian date conversions in exactly the reverse of what you'd expect. Cheers, Steve Poling, 28-Aug-1989, 47767 241 013150 UTC