summaryrefslogtreecommitdiff
path: root/include/time.h
blob: fc089cda45ab8a10720aeb8018adb36a9f6c7a18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef __TIME_H
#define __TIME_H

#define __BITS_TIMESPEC_H_
#include <bits/timespec.h>

#define __BITS_SIGEVENT_H_
#include <bits/sigevent.h>

#define __BITS_ERRNO_H_
#include <bits/errno.h>

#ifndef NULL
#define NULL ((void *)0)
#endif

#define CLOCKS_PER_SEC 1000000L
#define TIME_UTC       1

#define CLOCK_REALTIME		 0
#define CLOCK_MONOTONIC		 1
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID	 3

#define TIMER_ABSTIME 0x01

typedef __INT32_TYPE__ clockid_t;
typedef __INT64_TYPE__ clock_t;
typedef __SIZE_TYPE__ size_t;
typedef __INT32_TYPE__ clockid_t;
typedef __INT64_TYPE__ pid_t;
typedef void *timer_t;
typedef struct __locale_t *locale_t;

extern int daylight;
extern long timezone;
extern char *tzname[];

struct tm {
	int tm_sec;
	int tm_min;
	int tm_hour;
	int tm_mday;
	int tm_mon;
	int tm_year;
	int tm_wday;
	int tm_yday;
	int tm_isdst;
	long tm_gmtoff;
	const char *tm_zone;
};

struct itimerspec {
	struct timespec it_interval;
	struct timespec it_value;
};

char *asctime(const struct tm *);
clock_t clock(void);
int clock_getcpuclockid(pid_t, clockid_t *);
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
char *ctime(const time_t *);
double difftime(time_t, time_t);
struct tm *getdate(const char *);
struct tm *gmtime(const time_t *);
struct tm *gmtime_r(const time_t *restrict, struct tm *restrict);
struct tm *localtime(const time_t *);
struct tm *localtime_r(const time_t *restrict, struct tm *restrict);
time_t mktime(struct tm *);
int nanosleep(const struct timespec *, struct timespec *);
size_t strftime(char *restrict, size_t, const char *restrict,
		const struct tm *restrict);
size_t strftime_l(char *restrict, size_t, const char *restrict,
		  const struct tm *restrict, locale_t);
char *strptime(const char *restrict, const char *restrict, struct tm *restrict);
time_t time(time_t *);
int timer_create(clockid_t, struct sigevent *restrict, timer_t *restrict);
int timer_delete(timer_t);
int timer_getoverrun(timer_t);
int timer_gettime(timer_t, struct itimerspec *);
int timer_settime(timer_t, int, const struct itimerspec *restrict,
		  struct itimerspec *restrict);
int timespec_get(struct timespec *, int);
void tzset(void);

#endif