From: painvtqm@aol.com (Painvtqm)
Newsgroups: comp.sys.hp48
Subject: Auto Daylight Savings Time for the HP48
Date: 1 Nov 1997 21:08:42 GMT

Hello Everyone:

Well, the recent changeover from Daylight savings time to standard time
provided just the excuse not to do my schoolwork. I thought, why not get the
HP 48 to correct for daylight savings time automatically just like Windows 95
does it? In the US, we add 1 hour to standard time at 2:00 am on the first
sunday in April (Spring forward!). On the last sunday in October we subtract
it (Fall back). Surely the calculator is smart enough to do this?

The following programs use the alarm function of the calculator to adjust the
time accordingly and set up a new alarm for the next time change. I
time-traveled ten years into the future and the programs seem to work just
fine. No Global-2000 issues with the HP48! By the way, I know what the
HP68GX is going to look like ;-)!

You will need to have the programs on the home directory to guarantee that they
will work when the alarm goes off.

Apologies in advance if someone else has already done this as it seems kind of
an obvious enhancement. I did check deja-news and the ftp site but did not
see anything.

Yours,
PAINVTQM@AOL.COM
Robert Bellman, Jr.



%%HP: T(3)A(D)F(.);
DIR

 APRIL @ Run this program the first sunday of April at 2:00am
 \<< 6 FIX @ It calculates when the last sunday of October
DELALARM TIME 1 + @ occurs in the current year and resets the alarm
\->TIME EOCT @ to run the program OCTO at 2:00 am then.
 DO DUP DOW 
 UNTIL DUP
 IF 0 ==
 THEN 0
 ELSE DROP
.01 -
 END DUP 0
==
 END 2 DROPN 2
'OCTO' 0 4 \->LIST
STOALARM DROP
"SPRING FORWARD" @ Leaves this on the stack to let you know what
STD @ happened while you were sleeping (or otherwise occupied)
 \>>

 OCTO @ Run the last sunday in october at 2:00 am
 \<< 6 FIX
DELALARM TIME 1 -
\->TIME BAPR
 DO DUP DOW
 UNTIL DUP
 IF 0 ==
 THEN 0
 ELSE DROP
.01 +
 END DUP 0
==
 END 2 DROPN 2
'APRIL' 0 4 \->LIST
STOALARM DROP
"FALL BACK" STD
 \>>

 BAPR @ leaves 4.01XXXX on the stack, where XXXX is
 \<< 4.01 DATE @ one year from now. (April of next near)
\->STR 6 9 SUB OBJ\->
1000000 / + .000001
+
 \>>

 EOCT @ Leaves 10.31XXXX on the stack, where XXXX is
 \<< 10.31 DATE @ the current year.
\->STR 5 9 SUB OBJ\->
1000000 / +
 \>>
 DOW @ Requires a date XX.YYZZZZ on the stack as input
 \<< 10.171582 @ Returns an integer from 0 to 6 where 0 represents
SWAP DDAYS 7 MOD @ a Sunday, 1 represents a Monday, etc.
 \>>

 NXTALA { 4.051998 @ Put this list on level 2 of the stack and put
2 APRIL 0 } @ a 1 on level 1, then press STOALARM.
 @ IMPORTANT: If you install these programs
 @ after April 5, 1998 then you will have to
 @ adjust this alarm to the next date when
 @ daylight savings time occurs.
 @ if you are on daylight savings time when you
 @ install the programs, replace APRIL with OCTO.
 @ Otherwise, just change the date and leave the
 @ other list entries unchaged.

CST { DATE TIME @ Just a custom menu I used to debug these programs.
DATE RCLALARM \->TIME @ You don't need to use it at all.
\->DATE STOALARM }
END