home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!newsflash.concordia.ca!clyde.concordia.ca!proteus!randall
- From: randall@proteus.qc.ca (Randall Reid)
- Newsgroups: comp.bbs.waffle
- Subject: STATUS File
- Message-ID: <gTXcuB7w165w@proteus.qc.ca>
- Date: 17 Nov 92 00:28:03 GMT
- Reply-To: randall@proteus.qc.ca (Randall Reid)
- Organization: The Proteus Group, Montreal Canada
- Lines: 38
-
- Sorry if this is not the most appropriate newsgroup but this is
- a Waffle problem I'm trying to solve.
-
- I am writing a program to decide when to poll my uucp sites
- based on parametess such as <time of last connect>, <number
- of retries>, etc.
-
- I need to write a 4DOS batch file that will calculate the number
- of seconds since Jan 1st 1970 (this is what Waffle uses in the
- ./SPOOl/STATUS file. No I don't want to use the existing function
- in 'C' nor do I want to use Perl.
-
- So far I figured out (by trial and error):
-
- seconds = %@eval[%@DATE[%_date]*24*60*60 (seconds between 1980 and today)
- + %@time[%_time] (seconds since midnight)
- + 315576000 (seconds between 1970-1980)
- - 25200] (seconds in 7 hours)
-
- I used 365.25 * 10 * 24 * 60 *60 to compute the seconds from 1970-1980.
- I'm not sure if this is entirely accurate considering leap years.
-
- The subtraction of 7 hours from the formula seems to yield the correct result
- although I don't understand the significance of this number. I arrived at
- it purely by emperical means.
-
- So, can someone tell me if and where I'm going wrong in this formula. I
- can't help but think that the calculations for leap years must be more
- complex.. perhaps requiring some modulo arithmetic. And I don't understand
- why subtracting 7 hours seems to work.
-
- Thanks,
-
-
- --
- Randall J. Reid Internet: randall@proteus.qc.ca | randall@tpg.org
- Le Groupe Proteus Uucp: uunet!proteus!randall
- Montreal, Quebec CANADA Voice: +1 514 630 7103, FAX: +1 514 331 7934
-