]> diplodocus.org Git - nmh/blob - h/tws.h
Fix file descriptor leak in ruserpass()
[nmh] / h / tws.h
1 /* tws.h -- time routines.
2 */
3
4 /* A timezone given as a numeric-only offset will
5 be treated specially if it's in a zone that observes Daylight Saving Time.
6 For instance, during DST, a Date: like "Mon, 24 Jul 2000 12:31:44 -0700" will
7 be printed as "Mon, 24 Jul 2000 12:31:44 PDT". Without the code activated by
8 the following #define, that would be incorrectly printed as "...MST". */
9
10 struct tws {
11 int tw_sec; /* seconds after the minute - [0, 61] */
12 int tw_min; /* minutes after the hour - [0, 59] */
13 int tw_hour; /* hour since midnight - [0, 23] */
14 int tw_mday; /* day of the month - [1, 31] */
15 int tw_mon; /* months since January - [0, 11] */
16 int tw_year; /* 4 digit year (e.g. 1997) */
17 int tw_wday; /* days since Sunday - [0, 6] */
18 int tw_yday; /* days since January 1 - [0, 365] */
19 int tw_zone;
20 time_t tw_clock; /* if != 0, corresponding calendar value */
21 int tw_flags;
22 };
23
24 #define TW_NULL 0x0000
25
26 #define TW_SDAY 0x0003 /* how day-of-week was determined */
27 #define TW_SEXP 0x0001 /* explicitly given */
28 #define TW_SIMP 0x0002 /* implicitly given */
29
30 #define TW_SZEXP 0x0004 /* Explicit timezone. */
31
32 #define TW_DST 0x0010 /* daylight savings time */
33 #define TW_ZONE 0x0020 /* use numeric timezones only */
34
35 #define TW_SUCC 0x0040 /* Parsing was successful. */
36
37 #define dtwszone(tw) dtimezone (tw->tw_zone, tw->tw_flags)
38
39 /*
40 * prototypes
41 */
42 struct tws *dparsetime (char *);