home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / bbs / waffle / 4228 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.9 KB

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