xref: /plan9/sys/include/ape/time.h (revision 2d069fea74dfcc83c6858e715bf74862cb64720a)
1 #ifndef __TIME_H
2 #define __TIME_H
3 #pragma lib "/$M/lib/ape/libap.a"
4 
5 #include <stddef.h>
6 
7 #define CLOCKS_PER_SEC 1000
8 
9 /* obsolsecent, but required */
10 #define CLK_TCK CLOCKS_PER_SEC
11 
12 #ifndef _CLOCK_T
13 #define _CLOCK_T
14 typedef long clock_t;
15 #endif
16 #ifndef _TIME_T
17 #define _TIME_T
18 typedef long time_t;
19 #endif
20 
21 struct tm {
22 	int	tm_sec;
23 	int	tm_min;
24 	int	tm_hour;
25 	int	tm_mday;
26 	int	tm_mon;
27 	int	tm_year;
28 	int	tm_wday;
29 	int	tm_yday;
30 	int	tm_isdst;
31 };
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 extern clock_t clock(void);
38 extern double difftime(time_t, time_t);
39 extern time_t mktime(struct tm *);
40 extern time_t time(time_t *);
41 extern char *asctime(const struct tm *);
42 extern char *ctime(const time_t *);
43 extern struct tm *gmtime(const time_t *);
44 extern struct tm *localtime(const time_t *);
45 extern size_t strftime(char *, size_t, const char *, const struct tm *);
46 
47 #ifdef _REENTRANT_SOURCE
48 extern struct tm *gmtime_r(const time_t *, struct tm *);
49 extern struct tm *localtime_r(const time_t *, struct tm *);
50 extern char *ctime_r(const time_t *, char *);
51 #endif
52 
53 #ifdef _POSIX_SOURCE
54 extern void tzset(void);
55 #endif
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #ifdef _POSIX_SOURCE
62 extern char *tzname[2];
63 #endif
64 
65 #endif /* __TIME_H */
66