]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/zotnet/tws/phoon/tws.h
sbr/mts.c: Delete mmdlm2; use same-valued mmdlm1 instead.
[nmh] / docs / historical / mh-6.8.5 / zotnet / tws / phoon / tws.h
1 /* tws.h - header file for libtws date/time library */
2
3
4 /* Definition of the tws data structure. */
5
6 struct tws {
7 int tw_sec;
8 int tw_min;
9 int tw_hour;
10
11 int tw_mday;
12 int tw_mon;
13 int tw_year;
14
15 int tw_wday;
16 int tw_yday;
17
18 int tw_zone;
19
20 long tw_clock;
21
22 int tw_flags;
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 */
31 };
32
33
34 /* Declarations of routines. */
35
36 void twscopy( );
37 /* twscopy( &totws, &fromtws ) copies a tws */
38 int twsort( );
39 /* twsort( &tws1, &tws2 ) compares two tws's: 1 means tws1 is
40 later; -1 means tws1 is earlier; 0 means they are equal */
41 long twclock( );
42 /* twclock( &tws ) turns a tws into a time(3)-style clock value */
43 long twjuliandate( );
44 /* twjuliandate( &tws ) returns the Julian day number of a tws */
45 long twsubtract( );
46 /* twsubtract( &tws1, &tws2 ) returns seconds of difference */
47
48 /* These routines are functionally similar to the ctime(3) routines
49 in the standard Unix library. */
50 char *dctime( );
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 */
56 char *dasctime( );
57 /* dasctime( &tws, flags ) turns a tws into a string */
58 char *dtimezone( );
59 /* dtimezone( offset, flags ) returns the name of the time zone */
60
61 char *dtimenow( );
62 /* dtimenow( ) returns a string for the current date/time */
63
64 struct tws *dparsetime( );
65 /* dparsetime( &str ) turns a string into a tws */
66
67 struct tws *dtwstime( );
68 /* dtwstime( ) returns a tws for the current date/time */
69
70 #ifdef ATZ
71 #define dtime(cl) dasctime( dlocaltime( cl ), TW_NULL )
72 #else ATZ
73 #define dtime(cl) dasctime( dlocaltime( cl ), TW_ZONE )
74 #endif ATZ
75
76 #define dtwszone(tw) dtimezone( tw -> tw_zone, tw -> tw_flags )
77
78
79 extern char *tw_dotw[], *tw_ldotw[], *tw_moty[];