OSDN Git Service

Handle definition of struct timespec.
[uclinux-h8/uClibc.git] / include / time.h
1 /* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB.  If
16 not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA.  */
18
19 /*
20  *      ANSI Standard: 4.12 DATE and TIME       <time.h>
21  */
22
23 #ifndef _TIME_H
24 #define _TIME_H
25
26 #include <features.h>
27 #include <sys/time.h>
28
29 #ifndef _TIME_T
30 #define _TIME_T
31 typedef long time_t;
32 #endif
33
34 #ifndef _CLOCK_T
35 #define _CLOCK_T
36 typedef long clock_t;
37 #endif
38
39 #ifndef _SIZE_T
40 #define _SIZE_T
41 typedef unsigned int size_t;
42 #endif
43
44 #ifndef NULL
45 #ifdef __cplusplus
46 #define NULL    0
47 #else
48 #define NULL    ((void *) 0)
49 #endif
50 #endif
51
52 #define CLOCKS_PER_SEC  100
53 #define CLK_TCK         100     /* That must be the same as HZ ???? */
54
55 struct tm {
56         int tm_sec;
57         int tm_min;
58         int tm_hour;
59         int tm_mday;
60         int tm_mon;
61         int tm_year;
62         int tm_wday;
63         int tm_yday;
64         int tm_isdst;
65         /* Those are for future use. */
66         long int __tm_gmtoff__;
67         __const char *__tm_zone__;
68 };
69
70 #define __isleap(year)  \
71   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
72
73 extern char *tzname[2];
74 extern int daylight;
75 extern long int timezone;
76
77 __BEGIN_DECLS
78
79 extern int      stime __P ((time_t* __tptr));
80
81 extern clock_t  clock __P ((void));
82 extern time_t   time __P ((time_t * __tp));
83 extern __CONSTVALUE double difftime __P ((time_t __time2,
84                                           time_t __time1)) __CONSTVALUE2;
85 extern time_t   mktime __P ((struct tm * __tp));
86
87 extern char *   asctime __P ((__const struct tm * __tp));
88 extern char *   ctime __P ((__const time_t * __tp));
89 extern size_t   strftime __P ((char * __s, size_t __smax,
90                         __const char * __fmt, __const struct tm * __tp));
91 extern char *   strptime __P ((__const char * __s, __const char * __fmt,
92                         struct tm * __tm));
93
94 extern void     tzset __P ((void));
95
96 extern struct tm*       gmtime __P ((__const time_t *__tp));
97 extern struct tm*       localtime __P ((__const time_t * __tp));
98
99 #ifdef __USE_MISC
100 /* Miscellaneous functions many Unices inherited from the public domain
101   localtime package.  These are included only for compatibility.  */
102
103 /* Like `mktime', but for TP represents Universal Time, not local time.  */
104 extern time_t timegm __P ((struct tm *__tp));
105     
106 /* Another name for `mktime'.  */
107 extern time_t timelocal __P ((struct tm *__tp));
108
109 #endif
110
111 extern char     * asctime_r     __P((__const struct tm *, char *));
112 extern char     * ctime_r       __P((__const time_t *, char *));
113 extern struct tm* gmtime_r      __P((__const time_t *, struct tm *));
114 extern struct tm* localtime_r   __P((__const time_t *, struct tm *));
115
116 /* IEEE Std 1003.1b-1993. */
117 extern int nanosleep __P((__const struct timespec *__rqtp,
118                 struct timespec *__rmtp));
119
120 __END_DECLS
121
122 #endif