[comp.sys.handhelds] Control Alarms

ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (10/31/90)

I wrote a program to automatically adjust my HP48SX for daylight savings
time.  It worked ok when daylight savings began, but bit it when daylight
savings ended on sunday.

The reason:  apparently, when you have a control alarm which sets the
clock back, the alarm will keep triggering, rather than running just
once.

Is this documented anywhere?  I've checked through the manuals and
haven't found anything yet.

Anyway, the solution is to delete the "next" alarm, which is really
the current alarm, after setting the clock back.

<<
-29491200 CLKADJ			/* Fall Back */
DATE FINDALARM DELALARM			/* Delete current alarm */
>>

By the way, I'm just pointing out the behavior of the calculator.  I am
not calling this a bug in the HP!

Terrell

bill@videovax.tv.tek.com (William K. McFadden) (11/03/90)

In article <1990Oct31.034301.22601@isis.cs.du.edu> ebergman@isis.UUCP (Eric Bergman-Terrell) writes:
>
>I wrote a program to automatically adjust my HP48SX for daylight savings
>time.  It worked ok when daylight savings began, but bit it when daylight
>savings ended on sunday.
>
>The reason:  apparently, when you have a control alarm which sets the
>clock back, the alarm will keep triggering, rather than running just
>once.
>
>Is this documented anywhere?  I've checked through the manuals and
>haven't found anything yet.
>
>Anyway, the solution is to delete the "next" alarm, which is really
>the current alarm, after setting the clock back.
>
><<
>-29491200 CLKADJ			/* Fall Back */
>DATE FINDALARM DELALARM			/* Delete current alarm */
>>>
>
>By the way, I'm just pointing out the behavior of the calculator.  I am
>not calling this a bug in the HP!

Here's what I use.  This was posted last spring.  It worked just fine, by the
way, and automatically created an alarm for next year.  You'll want to change
the fall routine for next year's date, Oct. 27.
-------------------------------------------------------------------------------

Date:    05 Apr 90 19:54:17 GMT


From:    edp@jareth.enet.dec.com (Always mount a scratch monkey.)
Subject: Daylight Savings/Standard Time adjustment alarms
Newsgroups: comp.sys.handhelds
Sender: newsdaemon@shlump.nac.dec.com
Organization: Digital Equipment Corporation
Lines: 37

I have modified James H. Cloos' alarms for Daylight Savings/Standard Time
changes.  Below are two lists to give as arguments to STOALARM.  They are
smaller than the previous routines and also delete the alarms as they occur
instead of leaving them in the catalog.

The improvement is gained by directly calculating the day of the week (as a
difference from Sunday, 1 January 1950) and two hacks with dates:

	First, 11.11 -11 DATE+ will return the last day of October,
	regardless of the setting of flag -42, so IF-THEN-ELSE
	structures are not needed.  4.04 -3 DATE+ returns the first day
	of April.

	Second, 11.11 -11 DATE+ returns a value that includes the
	current year.

The two lists are:

%%HP: T(2)F(.);		@ CRC #CF20h 125.5 @
{ 28.10199 2 \<< DUP RCLALARM SWAP DELALARM 1 11.11 -11 DATE+ .000001
+ DUP 1.01195 DDAYS -7 MOD DATE+ PUT STOALARM DROP -29491200 CLKADJ OFF
\>> 0 }

%%HP: T(2)F(.);		@ CRC #FF5Dh 117.5 @
{ 7.041991 2 \<< DUP RCLALARM SWAP DELALARM 1 4.04 -3 DATE+ .000001 +
DUP 1.01195 DDAYS 7 MOD DATE+ PUT STOALARM DROP 29491200 CLKADJ OFF
\>> 0 }

To use these routines with the clock adjustment routines I posted previously,
change "29491200 CLKADJ" to "PATH HOME [path to time directory] 1_h ADJT EVAL",
and change use -1_h for the negative adjustment.

-- 
Bill McFadden    Tektronix, Inc.  P.O. Box 500  MS 58-639  Beaverton, OR  97077
bill@videovax.tv.tek.com,     {hplabs,uw-beaver,decvax}!tektronix!videovax!bill
Phone: (503) 627-6920       "The biggest difference between developing a missle
component and a toy is the 'cost constraint.'" -- John Anderson, Engineer, TI