]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Time/TimeVals.h
Add Socket Libraries.
[mirror_edk2.git] / StdLib / LibC / Time / TimeVals.h
CommitLineData
2aa62f2b 1/** @file\r
2 Definitions private to the Implementation of <time.h>.\r
3\r
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials are licensed and made available under\r
6 the terms and conditions of the BSD License that accompanies this distribution.\r
7 The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Portions derived from the NIH time zone package files,\r
14 which contain the following notice:\r
15\r
16 This file is in the public domain, so clarified as of\r
17 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).\r
18**/\r
19#ifndef _TIMEVAL_H\r
20#define _TIMEVAL_H\r
21\r
22extern struct state * lclptr;\r
23extern struct state * gmtptr;\r
24extern char * tzname[2];\r
25extern const char gmt[4];\r
26extern const char wildabbr[9];\r
27extern const int year_lengths[2];\r
28extern const int mon_lengths[2][MONSPERYEAR];\r
29extern long int timezone;\r
30extern int daylight;\r
31\r
32#define EFI_UNSPECIFIED_TIMEZONE 0x07FF\r
33\r
34/*\r
35** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.\r
36** We default to US rules as of 1999-08-17.\r
37** POSIX 1003.1 section 8.1.1 says that the default DST rules are\r
38** implementation dependent; for historical reasons, US rules are a\r
39** common default.\r
40*/\r
41#ifndef TZDEFRULESTRING\r
42#define TZDEFRULESTRING ",M4.1.0,M10.5.0"\r
43#endif\r
44\r
45// Facilities for external time-zone definition files do not currently exist\r
46#define NO_ZONEINFO_FILES\r
47\r
48#define EPOCH_DAY 5\r
49#define DAY_TO_uSEC 86400000000\r
50\r
51/* Rule type values for the r_type member of a rule structure */\r
52#define JULIAN_DAY 0 /* Jn - Julian day */\r
53#define DAY_OF_YEAR 1 /* n - day of year */\r
54#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */\r
55\r
56#ifdef TZNAME_MAX\r
57 #define MY_TZNAME_MAX TZNAME_MAX\r
58#endif /* defined TZNAME_MAX */\r
59\r
60#ifndef TZNAME_MAX\r
61 #define MY_TZNAME_MAX 255\r
62#endif /* !defined TZNAME_MAX */\r
63\r
64/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */\r
65#define is_digit(c) ((unsigned)(c) - '0' <= 9)\r
66\r
67#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400)\r
68\r
69#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))\r
70\r
71#ifndef INITIALIZE\r
72#define INITIALIZE(x) ((x) = 0)\r
73#endif /* !defined INITIALIZE */\r
74\r
75struct ttinfo { /* time type information */\r
76 LONG32 tt_gmtoff; /* UTC offset in seconds */\r
77 int tt_isdst; /* used to set tm_isdst */\r
78 int tt_abbrind; /* abbreviation list index */\r
79 int tt_ttisstd; /* TRUE if transition is std time */\r
80 int tt_ttisgmt; /* TRUE if transition is UTC */\r
81};\r
82\r
83struct lsinfo { /* leap second information */\r
84 time_t ls_trans; /* transition time */\r
85 LONG32 ls_corr; /* correction to apply */\r
86};\r
87\r
88struct state {\r
89 int leapcnt;\r
90 int timecnt;\r
91 int typecnt;\r
92 int charcnt;\r
93 time_t ats[TZ_MAX_TIMES];\r
94 unsigned char types[TZ_MAX_TIMES];\r
95 struct ttinfo ttis[TZ_MAX_TYPES];\r
96 char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt), (2 * (MY_TZNAME_MAX + 1)))];\r
97 struct lsinfo lsis[TZ_MAX_LEAPS];\r
98};\r
99\r
100struct rule {\r
101 int r_type; /* type of rule--see below */\r
102 int r_day; /* day number of rule */\r
103 int r_week; /* week number of rule */\r
104 int r_mon; /* month number of rule */\r
105 LONG32 r_time; /* transition time of rule */\r
106};\r
107\r
108#define JULIAN_DAY 0 /* Jn - Julian day */\r
109#define DAY_OF_YEAR 1 /* n - day of year */\r
110#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */\r
111\r
112__BEGIN_DECLS\r
d7ce7006 113extern void gmtload(struct state * const sp);\r
114extern void tzset(void);\r
2aa62f2b 115__END_DECLS\r
116\r
117#endif /* _TIMEVAL_H */\r