home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c019 / 1.ddi / ARC521_C / TWS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-01  |  2.9 KB  |  98 lines

  1. /* tws.h - header file for libtws date/time library 
  2.    (from mod.sources, Volume 8, Issue 81.)
  3.  
  4. {Second distribution of phoon, deltime, and libtws - 24feb87.
  5.      Jef Poskanzer, UniSoft Systems, Berkeley
  6.      unisoft!jef@ucbvax.Berkeley.Edu
  7.           ...ucbvax!unisoft!jef
  8.           (415)644-1230    }
  9.  
  10. This library is used to allow date stamping of files in Unix. The
  11. standard time routines in Unix do not provide routines to convert a
  12. parsed time into a time(3) clock value, so.... If you don't have this
  13. code, and can't get it, take out the references to it in arcdos.c,
  14. and remove the reference to tws.h and libtws.a in the Makefile.
  15.  
  16.             -- Howard Chu, March 3, 1987
  17.                University of Michigan Computing Center
  18.                hyc@umix.cc.umich.edu
  19.                ...uunet!umix!hyc    */
  20.  
  21.  
  22. /* Definition of the tws data structure. */
  23.  
  24. struct tws {
  25.     int     tw_sec;
  26.     int     tw_min;
  27.     int     tw_hour;
  28.  
  29.     int     tw_mday;
  30.     int     tw_mon;
  31.     int     tw_year;
  32.  
  33.     int     tw_wday;
  34.     int     tw_yday;
  35.  
  36.     int     tw_zone;
  37.  
  38.     long    tw_clock;
  39.  
  40.     int     tw_flags;
  41. #define TW_NULL 0x0000
  42. #define TW_SDAY 0x0007        /* how day-of-week was determined */
  43. #define   TW_SNIL 0x0000    /*   not given */
  44. #define   TW_SEXP 0x0001    /*   explicitly given */
  45. #define   TW_SIMP 0x0002    /*   implicitly given */
  46. #define TW_DST  0x0010        /* daylight savings time */
  47. #define TW_ZONE 0x0020        /* use numeric timezones only */
  48. #define TW_JUNK 0x0040        /* date string contained junk */
  49. };
  50.  
  51.  
  52. /* Declarations of routines. */
  53.  
  54. void twscopy( );
  55.     /* twscopy( &totws, &fromtws ) copies a tws */
  56. int twsort( );
  57.     /* twsort( &tws1, &tws2 ) compares two tws's: 1 means tws1 is
  58.        later; -1 means tws1 is earlier; 0 means they are equal */
  59. long twclock( );
  60.     /* twclock( &tws ) turns a tws into a time(3)-style clock value */
  61. long twjuliandate( );
  62.     /* twjuliandate( &tws ) returns the Julian day number of a tws */
  63. long twsubtract( );
  64.     /* twsubtract( &tws1, &tws2 ) returns seconds of difference */
  65.  
  66. /* These routines are functionally similar to the ctime(3) routines
  67.    in the standard Unix library. */
  68. char *dctime( );
  69.     /* dctime( &tws ) returns a string for the date/time passed in */
  70. struct tws *dlocaltime( );
  71.     /* dlocaltime( &clock ) turns a time(3) clock value into a tws */
  72. struct tws *dgmtime( );
  73.     /* dgmtime( &clock ) turns a time(3) clock value into a tws */
  74. char *dasctime( );
  75.     /* dasctime( &tws, flags ) turns a tws into a string */
  76. char *dtimezone( );
  77.     /* dtimezone( offset, flags ) returns the name of the time zone */
  78.  
  79. char *dtimenow( );
  80.     /* dtimenow( ) returns a string for the current date/time */
  81.  
  82. struct tws *dparsetime( );
  83.     /* dparsetime( &str ) turns a string into a tws */
  84.  
  85. struct tws *dtwstime( );
  86.     /* dtwstime( ) returns a tws for the current date/time */
  87.  
  88. #ifdef ATZ
  89. #define dtime(cl) dasctime( dlocaltime( cl ), TW_NULL )
  90. #else
  91. #define dtime(cl) dasctime( dlocaltime( cl ), TW_ZONE )
  92. #endif
  93.  
  94. #define dtwszone(tw) dtimezone( tw -> tw_zone, tw -> tw_flags )
  95.  
  96.  
  97. extern char   *tw_dotw[], *tw_ldotw[], *tw_moty[];
  98.