struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / include / time.h
blob267f942fe65709d8fd9554ad84a0a9fec137fb10
1 /*-------------------------------------------------------------------------
2 time.h
4 Copyright (C) 2001, Johan Knol <johan.knol AT iduna.nl>
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this library; see the file COPYING. If not, write to the
18 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301, USA.
21 As a special exception, if you link this library with other files,
22 some of which are compiled with SDCC, to produce an executable,
23 this library does not by itself cause the resulting executable to
24 be covered by the GNU General Public License. This exception does
25 not however invalidate any other reasons why the executable file
26 might be covered by the GNU General Public License.
27 -------------------------------------------------------------------------*/
29 #ifndef TIME_H
30 #define TIME_H
32 #ifndef __TIME_UNSIGNED
33 #define __TIME_UNSIGNED 1
34 #endif
36 /* Bounds-checking interfaces from annex K of the C11 standard. */
37 #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
39 #ifndef __RSIZE_T_DEFINED
40 #define __RSIZE_T_DEFINED
41 typedef size_t rsize_t;
42 #endif
44 #ifndef __ERRNO_T_DEFINED
45 #define __ERRNO_T_DEFINED
46 typedef int errno_t;
47 #endif
49 #endif
51 #if __TIME_UNSIGNED
52 struct tm
54 unsigned char tm_sec; /* Seconds. [0-60] */
55 unsigned char tm_min; /* Minutes. [0-59] */
56 unsigned char tm_hour; /* Hours. [0-23] */
57 unsigned char tm_mday; /* Day. [1-31] */
58 unsigned char tm_mon; /* Month. [0-11] */
59 int tm_year; /* Year since 1900 */
60 unsigned char tm_wday; /* Day of week. [0-6] */
61 int tm_yday; /* Days in year.[0-365] */
62 unsigned char tm_isdst; /* Daylight saving time */
63 unsigned char tm_hundredth; /* not standard 1/100th sec */
65 #else
66 struct tm
68 int tm_sec; /* Seconds. [0-60] */
69 int tm_min; /* Minutes. [0-59] */
70 int tm_hour; /* Hours. [0-23] */
71 int tm_mday; /* Day. [1-31] */
72 int tm_mon; /* Month. [0-11] */
73 int tm_year; /* Year since 1900 */
74 int tm_wday; /* Day of week. [0-6] */
75 int tm_yday; /* Days in year.[0-365] */
76 int tm_isdst; /* Daylight saving time */
77 char *tm_zone; /* Abbreviated timezone */
79 #endif
81 typedef unsigned long time_t;
83 time_t time(time_t *t);
84 struct tm *gmtime(time_t *timep);
85 struct tm *localtime(time_t *timep);
86 time_t mktime(struct tm *timeptr);
87 char *asctime(struct tm *timeptr);
88 char *ctime(time_t *timep);
90 #endif /* TIME_H */