home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3984 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  1.8 KB

  1. Xref: sparky comp.unix.programmer:3984 comp.unix.questions:9517
  2. Newsgroups: comp.unix.programmer,comp.unix.questions
  3. Path: sparky!uunet!munnari.oz.au!metro!bnd2.bnd.oz.au!johnw
  4. From: johnw@bnd2.bnd.oz.au (John Warburton)
  5. Subject: Need (today's date - 2 WORKING days) [was: Need (today's date + [1-7]]
  6. Message-ID: <1992Jul29.031546.26997@bnd2.bnd.oz.au>
  7. Organization: B&D Doors, Sydney, NSW, Australia
  8. References: <1992Jul28.072025.13886@cssc-syd.tansu.com.au>
  9. Date: Wed, 29 Jul 1992 03:15:46 GMT
  10. Lines: 46
  11.  
  12. From article <1992Jul28.072025.13886@cssc-syd.tansu.com.au>, by colinl@cssc-syd.tansu.com.au (Colin Lynch):
  13. > bernie@metapro.DIALix.oz.au (Bernd Felsche) writes:
  14. >     ...The most reliable way to do this is to first convert the current
  15. > date/time into a time_t type ("time_t" is defined in the system header file
  16. > <time.h>, and is basically a long containing the number of seconds since the
  17. > start of 01 Jan 1970 on most systems):
  18. >        #include <time.h>
  19. >        time_t   current_time;
  20. >        current_time = time((time_t *)0);
  21. >     Having done this, just set a macro for the length (in seconds) of one
  22. > day:
  23. >        #define ONE_DAY    ((60) * (60) * (24))
  24. >     From here, you can get the value for any day you want. For example, the 
  25. > value for two days' into the future would be:
  26. >       two_days_ahead = current_time + (ONE_DAY * 2);
  27. >   Hope this is helpful. Cheers, Colin.
  28.  
  29. Ok, that all works, but how do I get the day that was 2 WORKING (Mon..Fri) days
  30. ago? 
  31.  
  32. I can't seem to find any sort of general purpose way of doing this. Any
  33. pointers? 
  34.  
  35. John
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. -- 
  43. John Warburton                Internet:    johnw@bnd2.bnd.oz.au
  44. Systems Administrator            Phone:       +61 2 771 5566
  45. B & D Australia                Fax:         +61 2 771 6385
  46.           Living on ice-cream and chocolate kisses...
  47.