]> diplodocus.org Git - nmh/blob - h/tws.h
We're not using the .Bu macro anymore.
[nmh] / h / tws.h
1
2 /*
3 * tws.h
4 *
5 * $Id$
6 */
7
8 /* If the following is #defined, a timezone given as a numeric-only offset will
9 be treated specially if it's in a zone that observes Daylight Saving Time.
10 For instance, during DST, a Date: like "Mon, 24 Jul 2000 12:31:44 -0700" will
11 be printed as "Mon, 24 Jul 2000 12:31:44 PDT". Without the code activated by
12 the following #define, that'd be incorrectly printed as "...MST". */
13 #define ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST 1
14
15 struct tws {
16 int tw_sec; /* seconds after the minute - [0, 61] */
17 int tw_min; /* minutes after the hour - [0, 59] */
18 int tw_hour; /* hour since midnight - [0, 23] */
19 int tw_mday; /* day of the month - [1, 31] */
20 int tw_mon; /* months since January - [0, 11] */
21 int tw_year; /* 4 digit year (ie, 1997) */
22 int tw_wday; /* days since Sunday - [0, 6] */
23 int tw_yday; /* days since January 1 - [0, 365] */
24 int tw_zone;
25 time_t tw_clock; /* if != 0, corresponding calendar value */
26 int tw_flags;
27 };
28
29 #define TW_NULL 0x0000
30
31 #define TW_SDAY 0x0003 /* how day-of-week was determined */
32 #define TW_SNIL 0x0000 /* not given */
33 #define TW_SEXP 0x0001 /* explicitly given */
34 #define TW_SIMP 0x0002 /* implicitly given */
35
36 #define TW_SZONE 0x0004 /* how timezone was determined */
37 #define TW_SZNIL 0x0000 /* not given */
38 #define TW_SZEXP 0x0004 /* explicitly given */
39
40 #define TW_DST 0x0010 /* daylight savings time */
41 #define TW_ZONE 0x0020 /* use numeric timezones only */
42
43 #define TW_SUCC 0x0040 /* whether parsing was successful */
44 #define TW_YES 0x0040 /* yes, found */
45 #define TW_NO 0x0000 /* no, not found */
46
47 #define dtwszone(tw) dtimezone (tw->tw_zone, tw->tw_flags)
48
49 extern char *tw_dotw[];
50 extern char *tw_ldotw[];
51 extern char *tw_moty[];
52
53 /*
54 * prototypes
55 */
56 char *dtime (time_t *, int);
57 char *dtimenow (int);
58 char *dctime (struct tws *);
59 struct tws *dlocaltimenow (void);
60 struct tws *dlocaltime (time_t *);
61 struct tws *dgmtime (time_t *);
62 char *dasctime (struct tws *, int);
63 char *dtimezone (int, int);
64 void twscopy (struct tws *, struct tws *);
65 int twsort (struct tws *, struct tws *);
66 time_t dmktime (struct tws *);
67 void set_dotw (struct tws *);
68
69 struct tws *dparsetime (char *);
70