]> git.lizzy.rs Git - plan9front.git/blob - sys/include/ape/time.h
added (unfinished) nanosleep to APE
[plan9front.git] / sys / include / ape / time.h
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
56 struct timespec {
57         time_t tv_sec;
58         long tv_nsec;
59 };
60 extern int nanosleep(const struct timespec *req, struct timespec *rem);
61 #endif
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #ifdef _POSIX_SOURCE
68 extern char *tzname[2];
69 #endif
70
71 #endif /* __TIME_H */