home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 19107 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  1.8 KB

  1. Path: sparky!uunet!gatech!emory!wupost!spool.mu.edu!agate!ucbvax!mtxinu!sybase!venky
  2. From: venky@sybase.com (Venky)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Finding the number of days between two dates
  5. Message-ID: <27537@sybase.sybase.com>
  6. Date: 30 Dec 92 18:15:34 GMT
  7. References: <1fsk16INNhn0@cs.tut.fi> <1992Dec9.011317.26944@klaava.Helsinki.FI> <1992Dec10.181940.10135@linus.mitre.org>
  8. Sender: news@Sybase.COM
  9. Organization: Sybase, Inc.
  10. Lines: 32
  11.  
  12. In article <1992Dec10.181940.10135@linus.mitre.org> jrv@truth.mitre.org (Van Zandt) writes:
  13. >In article <1992Dec9.011317.26944@klaava.Helsinki.FI> wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
  14. >>pjh@cs.tut.fi (Haavisto Petri) writes:
  15. >>>1. When using mktime(), is it necessary to set all fields of the
  16. >>>tm-structure to correct values? 
  17. >>
  18. >>No.  tm_wday and tm_yday (and tm_isdst?) are computed by mktime based
  19. >>on the other fields.  In fact, the required fields do not have to be
  20. >>in their required fields either, mktime normalises them.  
  21. >
  22. >The Borland docs claim their mktime() normalizes those values, but
  23. >it doesn't.  (I'm posting a separate msg on that.)  My "Osborne McGraw-Hill
  24. >C the Complete Reference" doesn't mention the normalization.  Is it required
  25. >by the standard?
  26. >
  27. >                           - Jim Van Zandt <jrv@mitre.org>
  28.  
  29.   
  30.   ANSI Standard requires that tm_wday and tm_yday be computed 
  31.   based on the other fields in the 'struct tm'. I have seen 
  32.   that most versions of Unix do not support that, though.
  33.   
  34.   The latest HP-UX 9.0 however, has got this fix and works 
  35.   well. I should know.....
  36.   
  37.   As regards tm_isdst, the daylight savings time adjustment,
  38.   I don't think it is implicitly calculated. It is an input 
  39.   from the user. I remember using an environment variable 
  40.   ( TZ_DST  ?) to be assigned to tm_isdst ( with HP-UX ). 
  41.   
  42.   Thanx!
  43.   Venky
  44.