A powerful graphic Date&Time manager for the HP 49G/49g+

Timeman has a one-page command menu. The most important commands Dset and Tset obsolete the HP 49G Date&Time setting choose box and allows doing this in a pleasant graphic environment. Doing time setting this way is much more precise than with a choose box. Dset and Tset are described in Section 1 together with the command Noon which displays the noon meridian on a world map. The 3 screens can be conveniently cycled through from within their environments. Section 2 presents powerful clock calibration tools based on Tset and FxT?. The next command Aset sets a useful alarm manager menu described in Section 3. It makes alarm setting faster and, what is most important, you can now create alarms which repeat after one or several years at precisely the same day and time, to remind on birthdays, say. This is impossible with the builtin tools. The last command, ABox, sets the standard Alarm box for control at various steps.

Timeman does not affect the stack or PICT. Calendar display is affected by date flag -42. If cleared, then you see the US calendar format, otherwise the European one. Also date and time display in Noon or elsewhere are affected by the corresponding flags -42 and -41. The week-number shown within Dset is strict in accordance with ISO 8601. The user will always be informed whether DST is set or not. Store Timeman.lib in any port and attach it as usual with a warmstart. Timeman obsoletes many calendar and clock adjustment tools. The library adds itself to the TIME browser on the TIME key (74.3). Thus, the command menu of Timeman is quickly set. Convince yourself by pressing TIME after attachment. This nice feature requires ROM version 1.19-6. Tested also in ROM 1.22 and 2.0 on the HP49g+.

VERSION 1.2005
Compatible with hp 49g+ ROM 2.0 (which uses different key-codes for [ALPHA], [LS] and [RS]).

VERSION 7.2003
Updating of the former Timeman5.lib  New features added and bugs fixed. Dset environment is not left anymore if trying to set an invalid date. Alarm management much more powerful (Cuco and Cdwn removed). Corresponding changes have been made in version 6.2003.

VERSION 6.2003
This version distinguishes from vers. 7.2003 only in that Dset displays the number of the (work) week to which the scanned date belongs. The week-number, used mainly in business life, is in strict accordance with ISO standard 8601, accepted by most countries. See for instance www.merlyn.demon.co.uk/datefmts.htm#8601.

VERSION 5.2003
Noon screen redrawn. Noon meridian deviation from the mean sun at most one pixel.

VERSION 4.2003
Time Zone and DST displayed. European or US calendar format, dependent on flag -42.

VERSION 3.2003
Noon meridian displayer on world map added.

FIRST VERSION 1.2003 January 2003.

Section 1.  Date and Time management

Dset screen captureDset displays a ticking analog clock and a paging calendar. Initially, the actual date is highlighted. With RA (RightArrow) or LA (LeftArrow), you move a day at a time, with DA (DownArrow) or UA (UpArrow), a week at a time, with the + or - key, four weeks at a time, and with RS (RightShift) or LS (LeftShift), a year at a time. All of these keys are repeaters, i.e., if held down they'll repeat their action so that one may even browse through the centuries. The calendar can be browsed from 1583-01-01 through 9999-11-30. It's no problem to jump from 1991 to 2003, say, by holding down RS for a second or two. One gets a feeling for the longhold date shifting by experience. The calendar always displays one whole month at a time. You can reset the virtual date to the actual date with ALPHA or you can set a new actual date with STO, from Jan. 1991 through Dec. 2090. These limits are set by the operating system. Date browsing serves as a "perpetual calendar" or other aims, in particular resetting the date after a crash or a dead battery.

The I key (TOOL) displays information on various key functions. Perhaps most interesting is the NXT key. It cycles through Dset, the time setting mode Tset, the Noon meridian screen, and back to the Dset screen again. These modes can also be set directly with the commands Tset and Noon. Another interesting key in Dset or Tset is MODE. It switches to DST (seen on the screen) and the hour hand jumps one hour ahead. Pressing MODE again reverses this action which is controlled by Userflag 8, the only flag which is affected by Timeman . Timeman also displays the 2-digit week-number the scanned date, prefixed with "W" as is seen in the screen-shot above.

Tset screen captureTime setting mode is invoked by the command Tset or pressing the NXT key from the Dset display. In the Tset mode, RA or LA increase or decrease the current time by 1_s. UA or DA increase or decrease the time by 0.1_s, as indicated on the screen; this permits a very precise time setting, hardly be achieved in the standard manner. + or - increase or decrease by 1_min, and RS or LS by 1_h. The mentioned keys increase or decrease repeatedly if held down. When changing the time, you see the corresponding clock hands jump after the key is released. Adjusting the time across midnight also changes the date. In either the Tset or Dset screen, the +/- key toggles AM/PM on the clock face and changes the time by 12_h, but always in whichever direction preserves the date. Note that the time is set immediately, while date changing on the calendar always has to be confirmed with STO. This key has a different task in time setting mode; it's used for clock calibration, as described in Section 2. CANCEL aborts as usual while ENTER creates the adjustment alarm AAA, described in Section 2.

Noon shows a world map and the noon meridian when it's noon from eastern Asia westward to western North America. Thus, it shows you where is noon at present.Noon screen captureThe screen-shot shows us that at the displayed time in Berlin when sun-set starts, the sun is shining over New York. Noon does not depend on local time: At a given moment, someone in Asia or Europe or elsewhere sees the noon meridian at the same position as it should be. To achieve this, press LA or RA as often as needed for setting your Time Zone. The Time Zone, TZ, is negative for those living west of England. The TZ of central Europe is +1, set with RA. For setting the US Eastern Standard Time (TZ = -5) press LA 5 times. In each step the meridian jumps 1 hour (7 pixels) to the left. This only has to be done once; TZ remains in memory but can be changed any time. The MODE key changes DST as in the other screens. DST affects neither TZ nor the noon meridian but clearly affects the time displayed in the headline. The noon meridian is at the longitude where the local mean solar time is noon. Standard time zone boundaries take political considerations into account. Hence, a time zone where the clock says it's noon doesn't necessarily have the noon meridian running through it. It's interesting to watch the meridian in its slow move from East to West. It makes a barely noticeable move one pixel to the left every 8.6 minutes.

Any key not mentioned in this section turns the 49 off. The last screen is resumed at the next turn-on, provided that there was no alarm in the meantime. This autostart feature makes your HP49 an ideal Date&Time informer. You have the choice among three screens as regards Date&Time autostart: the clock and calendar display Dset, Tset, or Noon.

Section 2.  Clock Calibration

This means setting the right parameter for time adjustment by a program which will automatically be executed every night. Such an adjustment is recommended because the HP49 clock is not very exact and a small systematic time error may accumulate considerably. The basic screen for calibration is Tset. Calibration is started by fixing some time point when the HP49-time and real time are still running synchronously. This is done by STO which creates or overwrites a value FxT in the Hidden directory recording the very moment when STO is pressed.

The command FxT? recalls the date&time recorded in FxT and allows the user to purge it. FxT? beeps if FxT does not exist. As soon as a time drift is noticeable (normally after one or several days) exact time setting should be repeated. Touching a time setting key for minutes and seconds is recorded so that the drift can precisely be computed. Pressing ENTER creates an alarm (AAA = Automatic Adjusting Alarm) which from the next day on will silently run every night at 3:14:15 AM, correcting the clock as explained below. Toggling DST or changing only the hour time doesn't affect the calibration process. One can trustfully switch DST or local time while traveling into another time zone in the middle of a calibration process. This is achieved by updating FxT in such a way that CurrentTime minus FxT is constant. Any other method of changing the date or time is not recommended during the calibration period.

If there is already an AAA but further clock adjustment is necessary after some time, one may press ENTER again (repeated calibration). Instead of "AAA created" you see the message "AAA improved". This should be done at about the same time when the first calibration was finished. Another FxT need not be set. Once the clock run has been stabilized, FxT may be purged by answering the corresponding question in FxT? with YES. AAA does not refer to FxT. Of course, AAA also can be purged in the alarm browser, conveniently set with the command ABox.

You can identify AAA in the alarm browser easily. If edited you see a real in the Message field which we call dat (daily adjustment ticks). It is the head of a small program running AAA with nearly no power consumption. Timeman's time units are ticks (1_s = 8192 ticks). Let Span denote the time interval from FxT till now (in ticks). Further, let Tday denote the number of ticks per day and Drift the deviation of the 49-clock from real time in the time interval Span. Then dat is computed by the formula:

dat = (Tday * Drift)/Span.

Example. Suppose that the clock is slow about 1_s per day, then dat is approximately 8000. If calibration is finished by pressing ENTER in Tset in the morning, the clock will be very accurate in the morning. It tends to be slightly slow towards evening. After 3 AM the next day, when most people are sleeping, it reaches the delay maximum, but then it is suddenly slightly fast. It is easily seen that if a calibration is finished around 3 PM, maximal positive and negative drift are about the same (0.5_s).

If you've created FxT and done some imprecise adjustment shortly after it, then the computed drift is probably too large since FxT is too fresh. In such a case you'll see the message "drift too large" and no AAA is created. This message also appears if Timeman detects a dat greater than 45_s. This is rather unlikely and probably means that your unit is defective. FxT should not be too old for various reasons, at least not older than a battery lifetime. Remember that both the clock and each calibration procedure depend somewhat on environmental conditions. If you are not satisfied with the calibration effect, create a new AAA.

Section 3.  Alarms

Aset sets the alarm management menu with the six commands   SetA    ->Nx   CkA    Aview    EXIT    Abox.
The first command SetA launches a dialog box for alarm setting, see below.  To get this option directly from a key you may assign   Aset 11 KEYEVAL to this key or integrate this in the builtin TIME box, easily realized with Appsman. You may change the number of alarm sounds any time  by pressing ->Nx on a real or zint on the stack. The default is 7 times. Storing 0 in ->Nx means no alarm sound. The first you should do is testing an alarm with CkA. Since this is no stored alarm, it displays "Nonexistent alarm". Alarms made with SetA run always with dark screen to save the batteries and to make the sound nicer. Alarms made with Aset are not affected by any flags, in particular not by flag -56 or -57. Only if ->Nx is pressed on 0 the alarm runs very fast without sound and displays some message.You can also make your own alarm sound, see below.

Aview screen  of the alarm made by the Aset dialog from the screen belowAview is a browser through all alarms, see the screen-shot. Time on this screen is to mean the alarm date and time while Repeat shows the next term of repetition if any. This is particularly useful for alarms with long repeat intervals. The builtin Alarm box displays the repeat time of one year, say, as 52...WEEKS. This is no precise information. To be sure that this alarm will  indeed repeat at the expected day just use Aview. The picture shows the Aview screen of an alarm made with Aset for the 27th of February 2003 and a one-year repetition. It shows that alarm repeation will indeed take place on the 27th February in the next year. For alarms not anymore active you get in Aview the additional message "expired". Menu option EXIT leaves the menu and normally returns to Timeman's menu which sets the menu on the same key F5 (menu toggling). The last menu option Abox is identical with Abox from the main menu and sets the builtin alarm box.

SetA's sound will be replaced by your own self-composed wake-up melody if it exists in the current path in the variable '' (character 196, A umlaut, on key ALPHA A ALPHA LS 9). It will be repeated in the usual way. Even distinct alarms in different directories are possible. The unusual name has been chosen because it is not checked whether it contains a sound. This sound must respect the stack, otherwise you risk a crash.. A nice example (from Beethoven's 5th symphony) is:

1. 3. START 0.07 360. OVER BEEP WAIT NEXT 280. 0.5 BEEP

What your own alarm leaves on the stack when interrupted with CANCEL also appears when the repeating alarm is stopped with CANCEL. Better stop it with any other key. This package also contains the sound  b a c h  under the name Abach, the final theme from Bach's last work Die Kunst der Fuge. To use it simply store it into '' and press CkA.

The SetA dialog screen.

SetA Dialog screen capture"What" in the Alarm's dialog box may get some text but may also be skipped  (mandatory are only Date and Time of the alarm). Anything which is not a character string in the black field under "What" will be ignored. If  nothing is written under "What"  the alarm message will simply be the Alarm time. Alarms created with SetA are control alarms and hence affected by flag -56 (standard beep, not alarm beep).

The "Date" field must be given the alarm date as a real. in the HP49 DATE format which depends on  flag -42. For instance,  27.2  means the 27th of February of the current year, 2003 say, as in the screen-shot (flag -42 set). Typing 27.02 or 27.022003 is not necessary - only January must be encoded by 01 since, e.g., 3.1 will be read as 3.10 (3rd of October). If flag -42 is clear one has to write 2.27 under Date if the current year is meant. Date accepts precisely the same reals as ->DATE from the menu on the RS-hold  TIME key. It is obvious that an alarm setting for a date byond the 31th of December must contain full date information. Thus, writing 27.022004 or 2.272004 (flag -42 clear) under Date will realize the alarm in 2004.

"Time" must be given the mandatory alarm time, written as a real hh.mm or hh.mmss. Time accepts precisely the same reals as ->TIME from the the TIME menu. There is a special service for those who operate normally with flag -42 clear. If alarm time should be 19.15, say, one may write as well 7.15P instead (equivalently, 7.15 PM). This would be displayed as { 7.15 P } in the black field. SetA then sets the alarm time to 21.15.

The "Repeat" is particularly comfortable. Either skip it or put a number into the edit line and right after it one of the letters M, H, D, W, Y (for Minutes, Hours, Days, Weeks, Years). E.g., if 2M is printed then { 2. M } appears in the black field and the alarm will repeat after 2 minutes. With input .5M, the alarm repeats after 30 sec. If nY is the input, { n. Y } appears in the black field as in the screen-shot for n = 1. The HP49 creates the list { 1. Y } from the quickly printed 1Y provided Y is no global variable on the path (if it is you have to print 2'Y instead of 2Y). The screen-shot example made an alarm at the date displayed in the header. From that date on it will announce "W's birthday" every year at the same date, the 27th of February. In the general case, the alarm repeats after n years with identical date and time. Admissable are n = 1, 2, 3. Other reals may error or result in a non-intended alarm.

Important: If alarm setting is made the 29th of February with 1, 2, or 3 years repetition, the alarm repeats 1, 2 or 3 years later at the 1st of March (birthday rule). Pay attention to that Beep in the MODE screen is enabled. Otherwise there will be no alarm sound.

Remark 1. TZ is stored in the variable 'TPAR' (Time Parameter) in the Hidden directory, FxT in the hidden 'X'. Those who want that TZ displays also a number like +6.5 say, must store it by hand in 'TPAR' from the Hidden Directory. The Noon meridian shows the position of the so-called median sun which may deviate from the true sun at most 16_min or 2 pixels (mid-February and beginning November). AAA execution at 3:14:15 AM is based on the decimal representation of the real pi = 3.1415...

Remark 2. The HP49 reacts differently on an alarm if it arrives just when you're in an application or special environment, e.g., in the flag browser, in the Intermediate Enry mode, in Picture, in the Filer, etc. In ROM 19-6 it does not behave well if a command line is present. You regain the erased command line only with LS HIST. This behaviour will be fixed in ROM 19-7.

Remark 3. Time setting and calibration is perfectly working on HP 49G with ROM 1.19-6. HP 49g+ with ROM 1.22 up to ROM 2.0 adjustments of 0.1 s have no effect to the build in time and calibration does not work accurately due to a system bug. HP 49g+ with ROM 2.01 allows adjustments of 0.1 s, but adjustments and callibration will still have drawbacks.

Credits. Thanks to Heiko Arnemann, James M. Prange and Otto Praxl for beta-testing and suggestions in several details. Heiko also programmed the computation of the week number.

Wolfgang Rautenberg - raut@math.fu-berlin.de - www.math.fu-berlin.de/~raut