From cloos@batcomputer.tn.cornell.edu Fri Apr 6 22:36:37 1990 From: cloos@batcomputer.tn.cornell.edu (James H. Cloos Jr.) Newsgroups: comp.sys.handhelds Subject: Automated Daylight changing for the HP-48SX Keywords: Daylight Savings Time, DST Date: 4 Apr 90 05:32:14 GMT Reply-To: cloos@batcomputer.tn.cornell.edu (James H. Cloos Jr.) Organization: Cornell Information Technologies, Ithaca, NY 14853 The following two lists may be STOALARM'ed to automatically change your HP-48SX to and from Daylight Savings Time on the 1st Sunday in April and the last in October, respectively. Those of you who live in areas that have different schedules for DST will have to make some adjustments in rescheduling routines, but doing so shouldn't be too difficult. If anyone mails me the appropriate times and dates of DST changes in your area, I'll send you the required changes. After you type in the lists and check them with BYTES, put each on the stack in succession, and issue STOALARM. You may then PURGE any STO'ed copies if you want to conserve mem. (These assume flag -42 is SET for purposes of the checksums and the order of the dates that are the 1st element of the lists; they will, however, reschedule the next anual alarm correctly regardless of the setting of flag -42.) %%HP: T(3),A(R),F(.); @ #7554h if -42 is set ; 206.5 bytes if on stack { 28.10199 2 @ 0200 hrs on 28.Oct.90 @ \<< RCLALARM DUP 1 GET @ get the date @ .000001 + PATH @ increment year by one, get current path @ HOME \->411 UTIL DTMUTL @ change this to the path of your DOW routine @ OVER DOW DROP SWAP EVAL @ get the DOW of the next-year-date, EVAL the PATH @ NEG DATE+ DUP @ go back to the prev Sunday @ IF -42 FC? @ here we see if we are at the last Sun in Oct, @ THEN FP 100 * @ & go 1 week ahead if not. @ END IP 25 IF < THEN 7 DATE+ END 1 SWAP PUT STOALARM DROP -29491200 @ STOALARM, get rid of the reply, and change @ CLKADJ @ the time back one hour. \>> 0 } %%HP: T(3),A(R),F(.); @ #CBA9h if -42 set ; 198.5 bytes if on stack { 7.041991 2 @ 0200 hrs on 7.Apr.1991 \<< RCLALARM DUP 1 GET .000001 + PATH HOME \->411 UTIL DTMUTL OVER DOW @ again use the path to your DOW DROP SWAP EVAL NEG DATE+ @ routine DUP IF -42 FS? THEN FP 100 * END IP 4 IF < THEN 7 DATE+ END 1 SWAP PUT STOALARM DROP 29491200 CLKADJ \>> 0 } To use these, of course, you need a DOW routine that returns the DOW as something in level 2 (a STR in this case) and a number from 0 (SUN) to 6 (SAT) in level 1. Here is one translated to the 48 from the 28; routine >from the clock programs for the 28 as seen in clock.luse in the gmu archive: DOW @ #CC83h 53 bytes %%HP: T(3),A(R),F(.); \<< CJ 1 + 7 MOD DUP 1 + DAYS SWAP GET \>> CJ @ #9E33h 45 bytes %%HP: T(3),A(R),F(.); \<< 1.0116 SWAP DDAYS 2305448 + \>> @ A lot simpler than the routine @ for the 28, huh? All I did was to get the number of days since some @ given date in the past that is either 1.Jan, 2.Feb, ... or 12.Dec of a @ given year (this way we can ignore flag -42) and add the j-day of that @ given date. DAYS @ #BC88h 98.5 bytes {"Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"} Sometime soon I'll post my whole traslation of Luse's date/time routines (including the moon program that was posted a while back and which I added to the CLOCK display on my 28) and of the 411 suite, plus some other stuff. (With lick I'll be getting my cable from Educalc soon (I mailed a check rather than phoning in a credit card order, and had it sent UPS ground rather than FedEx standard, like with my 48SX order, which was pld on Saturday, went out Monday morning, and was delivered before 1300EST Tuesday afternoon!!!!) and will then be able to transfer stuff sans keyboard&eyes!) -JimC -- James H. Cloos, Jr. "Entropy isn't what it used to be." JHC@CrnlThry.BITNET --c/o Fortune @ batcomputer.UUCP JHC@TCGould.TN.Cornell.EDU #include !cornell!batcomputer!cloos PersonalZipCode: 14048-0772 From rhelps@yoda.byu.edu Fri Apr 6 22:40:34 1990 From: rhelps@yoda.byu.edu Newsgroups: comp.sys.handhelds Subject: Re: Day of week (was Automated daylight changing ...) Date: 5 Apr 90 23:39:42 GMT Jim Cloos uses a Day of Week (DOW) routine in his program. I have some improvements to offer. When I first got my 48SX and saw all the time and date functions I was a little surprised that a DOW function was not included (I know, I know "Life is short and ROM is full"), so I wrote one as my first attempt at a 48 program. Looking at Jim's 28S adaptation I improved mine a bit and here it is. Notes Enter date in either dd.mmyyyy or mm.ddyyyy format and execute DOW. Returns day number (0=Sun, 6=Sat) in level 2 and text day in level 1. This program like almost every DOW routine I have seen, will only work for the Gregorian calendar. The Gregorian calendar was first introduced in October 1582 and took several hundred years to be adopted by various countries around the world. Specifically this routine will give wrong answers for dates before Dec 12 1582. Good enough for most purposes. The major difference between this routine and Jim's is that I don't use Julian day numbering. With a known date (Dec 12 1582 is a Sunday) and a DDAYS function it isn't necessary. This routine is about 25% faster and 25% shorter than Jim's. Any improvements or suggestions are welcome. 'DOW' << 12.121582 SWAP DDAYS @ Days since Sunday Dec 12 1582 7 MOD DUP 1 + @ Get day number { "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Staurday"} SWAP GET >> -Richard Helps- From edp@jareth.enet.dec.com Fri Apr 6 22:41:13 1990 From: edp@jareth.enet.dec.com (Always mount a scratch monkey.) Newsgroups: comp.sys.handhelds Subject: Daylight Savings/Standard Time adjustment alarms Date: 5 Apr 90 19:54:17 GMT Organization: Digital Equipment Corporation 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. -- edp (Eric Postpischil) "Always mount a scratch monkey." edp@jareth.enet.dec.com