1 /* 2 ** tws.h 3 */ 4 5 /* 6 ** If the following is #defined, a timezone given as a numeric-only 7 ** offset will be treated specially if it's in a zone that observes 8 ** Daylight Saving Time. For instance, during DST, a Date: like "Mon, 9 ** 24 Jul 2000 12:31:44 -0700" will be printed as "Mon, 24 Jul 2000 10 ** 12:31:44 PDT". Without the code activated by the following #define, 11 ** that'd be incorrectly printed as "...MST". 12 */ 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 42 #define TW_SUCC 0x0040 /* whether parsing was successful */ 43 #define TW_YES 0x0040 /* yes, found */ 44 #define TW_NO 0x0000 /* no, not found */ 45 46 #define dtwszone(tw) dtimezone(tw->tw_zone, tw->tw_flags) 47 48 extern char *tw_dotw[]; 49 extern char *tw_ldotw[]; 50 extern char *tw_moty[]; 51 52 /* 53 ** prototypes 54 */ 55 char *dtime(time_t *); 56 char *dtimenow(void); 57 char *dctime(struct tws *); 58 struct tws *dlocaltimenow(void); 59 struct tws *dlocaltime(time_t *); 60 struct tws *dgmtime(time_t *); 61 char *dasctime(struct tws *); 62 char *dtimezone(int, int); 63 void twscopy(struct tws *, struct tws *); 64 int twsort(struct tws *, struct tws *); 65 time_t dmktime(struct tws *); 66 void set_dotw(struct tws *); 67 68 struct tws *dparsetime(char *); 69