1 /* tws.h - header file for libtws date/time library */
4 /* Definition of the tws data structure. */
23 #define TW_NULL 0x0000
24 #define TW_SDAY 0x0007 /* how day-of-week was determined */
25 #define TW_SNIL 0x0000 /* not given */
26 #define TW_SEXP 0x0001 /* explicitly given */
27 #define TW_SIMP 0x0002 /* implicitly given */
28 #define TW_DST 0x0010 /* daylight savings time */
29 #define TW_ZONE 0x0020 /* use numeric timezones only */
30 #define TW_JUNK 0x0040 /* date string contained junk */
34 /* Declarations of routines. */
37 /* twscopy( &totws, &fromtws ) copies a tws */
39 /* twsort( &tws1, &tws2 ) compares two tws's: 1 means tws1 is
40 later; -1 means tws1 is earlier; 0 means they are equal */
42 /* twclock( &tws ) turns a tws into a time(3)-style clock value */
44 /* twjuliandate( &tws ) returns the Julian day number of a tws */
46 /* twsubtract( &tws1, &tws2 ) returns seconds of difference */
48 /* These routines are functionally similar to the ctime(3) routines
49 in the standard Unix library. */
51 /* dctime( &tws ) returns a string for the date/time passed in */
52 struct tws *dlocaltime( );
53 /* dlocaltime( &clock ) turns a time(3) clock value into a tws */
54 struct tws *dgmtime( );
55 /* dgmtime( &clock ) turns a time(3) clock value into a tws */
57 /* dasctime( &tws, flags ) turns a tws into a string */
59 /* dtimezone( offset, flags ) returns the name of the time zone */
62 /* dtimenow( ) returns a string for the current date/time */
64 struct tws *dparsetime( );
65 /* dparsetime( &str ) turns a string into a tws */
67 struct tws *dtwstime( );
68 /* dtwstime( ) returns a tws for the current date/time */
71 #define dtime(cl) dasctime( dlocaltime( cl ), TW_NULL )
73 #define dtime(cl) dasctime( dlocaltime( cl ), TW_ZONE )
76 #define dtwszone(tw) dtimezone( tw -> tw_zone, tw -> tw_flags )
79 extern char *tw_dotw[], *tw_ldotw[], *tw_moty[];