script for seconds in given month?

Hendrik van Rooyen mail at microcorp.co.za
Tue Apr 17 07:44:55 CEST 2007


"Paul McGuire" <pt...g at austin.rr.com> wrote:

> On Apr 16, 11:22 am, "edfialk" <edfi... at gmail.com> wrote:
> > Hi, does anyone happen to know of a script that would return the
> > number of seconds in a month if I give it a month and a year?
> >
> > My python is a little weak, but if anyone could offer some suggestions
> > I think I could handle it myself, or if anyone happens to know of a
> > script already written that performs this I would be extremely
> > grateful.
> >
> > Thanks!
> > -Ed
> 
> Do you need to handle leap seconds too? (not a joke)
> 
> -- Paul

>From some assembler, here are some values.
Stick them in a two dicts for normal and leap year.
the first one is a cumulative table, I included it in 
case you can use it...

; SECONDS TABLES (LITTLE ENDIAN)


MSECTAB_NORM:

 DB 080H,033H,0E1H,001H ;MONTH ZERO HAS FULL YEAR SECONDS
 DB 000H,000H,000H,000H ;JANUARY
 DB 080H,0DEH,028H,000H ;FEBRUARY
 DB 080H,0C8H,04DH,000H ;MARCH
 DB 000H,0A7H,076H,000H ;APRIL
 DB 000H,034H,09EH,000H ;MAY
 DB 080H,012H,0C7H,000H ;JUNE
 DB 080H,09FH,0EEH,000H ;JULY
 DB 000H,07EH,017H,001H ;AUGUST
 DB 080H,05CH,040H,001H ;SEPTEMBER
 DB 080H,0E9H,067H,001H ;OCTOBER
 DB 000H,0C8H,090H,001H ;NOVEMBER
 DB 000H,055H,0B8H,001H ;DECEMBER


MSECTAB_LEAP:

 DB 000H,085H,0E2H,001H ;MONTH ZERO HAS FULL LEAP YEAR SECONDS
 DB 000H,000H,000H,000H ;JANUARY
 DB 080H,0DEH,028H,000H ;FEBRUARY
 DB 000H,01AH,04FH,000H ;MARCH
 DB 080H,0F8H,077H,000H ;APRIL
 DB 080H,085H,09FH,000H ;MAY
 DB 000H,064H,0C8H,000H ;JUNE
 DB 000H,0F1H,0EFH,000H ;JULY
 DB 080H,0CFH,018H,001H ;AUGUST
 DB 000H,0AEH,041H,001H ;SEPTEMBER
 DB 000H,03BH,069H,001H ;OCTOBER
 DB 080H,019H,092H,001H ;NOVEMBER
 DB 080H,0A6H,0B9H,001H ;DECEMBER


; NUMBER OF SECONDS IN MONTH (LITTLE ENDIAN)


MSTAB_NORM:

 DB 000H,000H,000H,000H ;MONTH ZERO HAS NO SECONDS
 DB 080H,0DEH,028H,000H ;JANUARY
 DB 000H,0EAH,024H,000H ;FEBRUARY
 DB 080H,0DEH,028H,000H ;MARCH
 DB 000H,08DH,027H,000H ;APRIL
 DB 080H,0DEH,028H,000H ;MAY
 DB 000H,08DH,027H,000H ;JUNE
 DB 080H,0DEH,028H,000H ;JULY
 DB 080H,0DEH,028H,000H ;AUGUST
 DB 000H,08DH,027H,000H ;SEPTEMBER
 DB 080H,0DEH,028H,000H ;OCTOBER
 DB 000H,08DH,027H,000H ;NOVEMBER
 DB 080H,0DEH,028H,000H ;DECEMBER

MSTAB_LEAP:

 DB 000H,000H,000H,000H ;MONTH ZERO HAS NO SECONDS
 DB 080H,0DEH,028H,000H ;JANUARY
 DB 080H,03BH,026H,000H ;FEBRUARY
 DB 080H,0DEH,028H,000H ;MARCH
 DB 000H,08DH,027H,000H ;APRIL
 DB 080H,0DEH,028H,000H ;MAY
 DB 000H,08DH,027H,000H ;JUNE
 DB 080H,0DEH,028H,000H ;JULY
 DB 080H,0DEH,028H,000H ;AUGUST
 DB 000H,08DH,027H,000H ;SEPTEMBER
 DB 080H,0DEH,028H,000H ;OCTOBER
 DB 000H,08DH,027H,000H ;NOVEMBER
 DB 080H,0DEH,028H,000H ;DECEMBER


; *****************************************************************

hth - Hendrik




More information about the Python-list mailing list