home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / libnix-0.8-src.lha / libnix-0.8 / sources / nix / time / time.c < prev   
Encoding:
C/C++ Source or Header  |  1994-12-12  |  530 b   |  25 lines

  1. #include <time.h>
  2. #include <dos/dos.h>
  3. #ifdef __GNUC__
  4. #include <inline/dos.h>
  5. #endif
  6.  
  7. extern long __gmtoffset;
  8.  
  9. time_t time(time_t *tloc)
  10. { struct DateStamp t;
  11.   time_t ti;
  12.   DateStamp(&t); /* Get timestamp */
  13.   ti=((t.ds_Days+2922)*1440+t.ds_Minute+__gmtoffset)*60+
  14.      t.ds_Tick/TICKS_PER_SECOND;
  15.   if(tloc!=NULL)
  16.     *tloc=ti;
  17.   return ti;
  18. }
  19.  
  20. /*
  21.  * 2922 is the number of days between 1.1.1970 and 1.1.1978 (2 leap years and 6 normal)
  22.  * 1440 is the number of minutes per day
  23.  *   60 is the number of seconds per minute 
  24.  */ 
  25.