According to Bob Brown:
>
> Jesus Valdez writes:
> >Stan Sieler wrote:
> >>
> >> Wirt writes:
> >> ...
> >> > The question is: is that day calculation correct? Although when I
> >> ...
> >> > However I was very pleased at HPWorld '96 when Vladimir Volokh wanted to
> >> > show me the new calendar features in MPEX that Eugene had recently
> >> > programmed into MPEX (which, BTW, also fails on December 31, 9999).
> >>
> >> (Fails after 9999-12-31, I think you meant)
> >>
> >> > Thus, after a fit of dueling calendars on side-by-side terminals, we
> >> > demonstrated to each other that our two calendars agreed perfectly. That
> >> > demonstration was quite reassuring. Eugene's date calculations so far
> >> > have been the only completely independent verfication that QueryCalc's
> >> > calendar is correct -- or at least wrong in the same way MPEX is.
> >>
> >> >From HP-UX & AIX:
> >>
> >> cal 12 9999
> >> December 9999
> >> Sun Mon Tue Wed Thu Fri Sat
> >> 1 2 3 4
> >> 5 6 7 8 9 10 11
> >> 12 13 14 15 16 17 18
> >> 19 20 21 22 23 24 25
> >> 26 27 28 29 30 31
> >>
> >> BTW, even a "standard" routine like cal varies from Unix to Unix:
> >>
> >> HP-UX: cal 1 10000
> >> Bad argument
> >>
> >> AIX: cal 1 10000
> >> 0702-001 Specify month as number between 1 and 12
> >> Specify year as number between 1 and 9999.
> >>
> >> POSIX on MPE/iX, OTOH, appears to be implemented by a Stanford fan:
> >>
> >> MPE/iX: cal 1 10000
> >> cal: not found
> >>
> >> :)
> >>
> >> --
> >> Stan Sieler [log in to unmask]
> >> http://www.allegro.com/sieler.htmlI
>
> >don't see any problem with the year 10000 and MPEX:
> >% CALENDAR DECEMBER,10000
> > December 10000
> >
> >
> > SUN MON TUE WED THU FRI SAT
> >
> > 1 2
> > 3 4 5 6 7 8 9
> > 10 11 12 13 14 15 16
> > 17 18 19 20 21 22 23
> > 24 25 26 27 28 29 30
> > 31
>
>
> Actually, MPEX seems to be cool out to 32766, which is a relief :)
>
> calendar dec,32766
>
> December 32766
>
> SUN MON TUE WED THU FRI SAT
>
> 1 2 3
> 4 5 6 7 8 9 10
> 11 12 13 14 15 16 17
> 18 19 20 21 22 23 24
> 25 26 27 28 29 30 31
>
> 32768 causes an error message, which is to be expected:
>
> calendar dec,32768
>
> Error: DATEBUILD passed bad year, month, or day (-32768/12/1).
>
> 32767 causes MPEX to go into a (seemingly) endless, CPU munching loop.
> Fortunately, VESoft has a little bit of time before they need to fix this.
> :)
>
> -Bob
> [log in to unmask]
Here's a Command file that returns the day of the week for a
given date. Nothing fancy - no syntax or reasonableness
checks. Enter the date as a parm of the command file name at
the ":" prompt. I checked it against some of the dates in this
e-mail thread and it seems to be accurate or at least equally
inacurate.
The algorithm used is from a child's book of number games.
Sorry, I can't cite the book. It has been gone from our
library shelves for a number of years. This algorithm was one
of a number of lightning calculations used in stage shows early
in the century.
DAYOWEEK:
parm d="01/01/2000"
setvar cal_day "!d"
setvar mo str(cal_day,1,2)
setvar day str(cal_day,4,2)
setvar year str(cal_day,7,(len(cal_day) - 6))
setvar wkday "SUNMONTUEWEDTHUFRISAT"
setvar wdleapy "034025036146"
setvar wdleapn "144025036146"
setvar century !year/100*100
setvar yr !year-!century
setvar wday wdleapn
if (((!year mod 4) = 0) and ((!year mod 100) <> 0)) or ((!year mod 400) = 0)
setvar wday wdleapy
endif
setvar dv str(wday,!mo,1)
setvar dayval (!yr/4)+!yr+!dv+!day
if (!century mod 400) = 0
setvar dayval (!dayval - 1)
endif
setvar dayval (!dayval mod 7)
if !dayval = 0
setvar dayval 7
endif
setvar daywk str(wkday,(!dayval*3-2),3)
echo The day of the week for !cal_day is !daywk.
--
===============================================================
Steven P. Barrett (703) 222-3132 - voice
Automation Coordinator (703) 222-3135 - FAX
Fairfax County Public Library [log in to unmask]
Technical Operations Center
4000 Stringfellow Rd.
Chantilly, VA 22021
--- The opinions expressed here are mine alone . ---
===============================================================
|