XenevaOS
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1
11#ifndef NS_QJS_TIME_H
12#define NS_QJS_TIME_H
13
14#ifndef NS_QJS_STDDEF_READY
15#include <stddef.h>
16#endif
17#include <stdint.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#define CLOCKS_PER_SEC 1000L
24
25typedef long clock_t;
26typedef long time_t;
27
28struct tm {
29 int tm_sec; /* seconds [0-59] */
30 int tm_min; /* minutes [0-59] */
31 int tm_hour; /* hours [0-23] */
32 int tm_mday; /* day of month [1-31] */
33 int tm_mon; /* month [0-11] */
34 int tm_year; /* years since 1900 */
35 int tm_wday; /* weekday [0=Sunday] */
36 int tm_yday; /* day of year [0-365] */
37 int tm_isdst; /* DST flag */
39 const char* tm_zone;
40};
41
42struct timespec {
44 long tv_nsec;
45};
46
47struct timeval {
48 long tv_sec;
49 long tv_usec;
50};
51
52/* XEClib's sys/time.h refers to the bare typedef name. */
53typedef struct timeval timeval;
54
55/* Clock ids (also mirrored in port/pthread.h). */
56#define CLOCK_REALTIME 0
57#define CLOCK_MONOTONIC 1
58#define CLOCK_PROCESS_CPUTIME_ID 2
59#define CLOCK_THREAD_CPUTIME_ID 3
60
61struct tm* gmtime(const time_t* t);
62struct tm* localtime(const time_t* t);
63struct tm* gmtime_r(const time_t* t, struct tm* out);
64struct tm* localtime_r(const time_t* t, struct tm* out);
65time_t mktime(struct tm* tm);
67char* ctime(const time_t* t);
68clock_t clock(void);
69double difftime(time_t a, time_t b);
70int gettimeofday(struct timeval* tv, void* tz);
71int nanosleep(const struct timespec* req, struct timespec* rem);
72
73/* fmt: since XCC's own time.h passes `timeval*` overloads to the same
74 * implementation; Xeneva builds use the portable signature above. */
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif
unsigned long clock_t
Definition types.h:52
long time_t
Definition types.h:53
XE_LIB int nanosleep(const struct timespec *req, struct timespec *rem)
Definition time.cpp:195
XE_LIB clock_t clock(void)
Definition time.cpp:111
XE_LIB time_t mktime(struct tm *)
Definition time.cpp:125
XE_LIB int gettimeofday(timeval *val)
XE_LIB time_t time(time_t *t)
Definition time.cpp:164
XE_LIB struct tm * gmtime(const time_t *)
Definition time.cpp:49
XE_LIB double difftime(time_t, time_t)
Definition time.cpp:107
XE_LIB char * ctime(const time_t)
Definition time.cpp:117
struct tm * localtime(const time_t *t)
Definition port.c:139
long clock_t
Definition time.h:25
long time_t
Definition time.h:26
struct tm * localtime_r(const time_t *t, struct tm *out)
Definition port.c:144
struct tm * gmtime_r(const time_t *t, struct tm *out)
Definition port.c:135
XETime t
Definition main.cpp:53
size_t a
Definition main.cpp:156
size_t b
Definition main.cpp:156
#define out(...)
Definition main.cpp:65
Definition time.h:80
long tv_nsec
Definition time.h:82
time_t tv_sec
Definition time.h:81
Definition time.h:47
long tv_sec
Definition time.h:48
long tv_usec
Definition time.h:49
Definition time.h:63
int tm_mon
Definition time.h:68
const char * tm_zone
Definition time.h:39
int tm_year
Definition time.h:69
int tm_hour
Definition time.h:66
int tm_sec
Definition time.h:64
int tm_isdst
Definition time.h:72
long tm_gmtoff
Definition time.h:38
int tm_yday
Definition time.h:71
int tm_mday
Definition time.h:67
int tm_min
Definition time.h:65
int tm_wday
Definition time.h:70