ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
time.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <__esbmc/stddefs.h>
5#include <stddef.h> /* size_t */
6
8
9#ifndef __time_t_defined
10#define __time_t_defined 1
11#define _TIME_T /* macOS guard */
12/* On Windows, time_t is __time64_t (long long) because long is 32-bit.
13 On Unix-like systems, time_t is typically long (which is 64-bit on LP64). */
14#ifdef _WIN32
15typedef long long time_t;
16#else
17typedef long time_t;
18#endif
19#endif
20
21#ifndef __clock_t_defined
22#define __clock_t_defined 1
23#define _CLOCK_T /* macOS guard */
24typedef long clock_t;
25#endif
26
27#ifndef __clockid_t_defined
28#define __clockid_t_defined 1
29typedef int clockid_t;
30#endif
31
32#ifndef __timer_t_defined
33#define __timer_t_defined 1
34typedef void *timer_t;
35#endif
36
37#ifndef __pid_t_defined
38#define __pid_t_defined 1
39typedef int pid_t;
40#endif
41
42#define CLOCKS_PER_SEC 1000000L
43#define TIME_UTC 1
44
45/* POSIX clock IDs */
46#define CLOCK_REALTIME 0
47#define CLOCK_MONOTONIC 1
48#define CLOCK_PROCESS_CPUTIME_ID 2
49#define CLOCK_THREAD_CPUTIME_ID 3
50#define CLOCK_MONOTONIC_RAW 4
51#define CLOCK_REALTIME_COARSE 5
52#define CLOCK_MONOTONIC_COARSE 6
53#define CLOCK_BOOTTIME 7
54
55/* Flags for clock_nanosleep and timer_settime */
56#define TIMER_ABSTIME 1
57
58#ifndef NULL
59# ifdef __cplusplus
60# define NULL 0
61# else
62# define NULL ((void *)0)
63# endif
64#endif
65
66#ifndef _STRUCT_TIMESPEC
67#define _STRUCT_TIMESPEC 1
69{
71 long tv_nsec;
72};
73#endif
74
75#ifndef _STRUCT_ITIMERSPEC
76#define _STRUCT_ITIMERSPEC 1
78{
81};
82#endif
83
84#ifndef __struct_tm_defined
85#define __struct_tm_defined 1
86struct tm
87{
88 int tm_sec;
89 int tm_min;
92 int tm_mon;
97 /* glibc extensions */
99 const char *tm_zone;
100};
101#endif
102
103time_t time(time_t *tloc);
104double difftime(time_t end, time_t beginning);
105clock_t clock(void);
106time_t mktime(struct tm *timeptr);
107/* GNU/BSD extension: mktime's UTC counterpart */
108time_t timegm(struct tm *timeptr);
109
110struct tm *localtime(const time_t *timer);
111struct tm *gmtime(const time_t *timer);
112struct tm *localtime_r(const time_t *timer, struct tm *buf);
113struct tm *gmtime_r(const time_t *timer, struct tm *buf);
114
115char *asctime(const struct tm *timeptr);
116char *ctime(const time_t *timer);
117
118/* POSIX reentrant versions */
119char *asctime_r(const struct tm *timeptr, char *buf);
120char *ctime_r(const time_t *timer, char *buf);
121
122size_t strftime(char *s, size_t maxsize, const char *format,
123 const struct tm *timeptr);
124
125/* POSIX string parsing */
126char *strptime(const char *s, const char *format, struct tm *tm);
127
128int timespec_get(struct timespec *ts, int base);
129
130/* POSIX clock functions */
131int clock_getres(clockid_t clk_id, struct timespec *res);
132int clock_gettime(clockid_t clk_id, struct timespec *tp);
133int clock_settime(clockid_t clk_id, const struct timespec *tp);
134int clock_nanosleep(clockid_t clk_id, int flags, const struct timespec *request,
135 struct timespec *remain);
136
137/* POSIX sleep functions */
138int nanosleep(const struct timespec *req, struct timespec *rem);
139
140/* POSIX timers */
141struct sigevent; /* Forward declaration from signal.h */
142int timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid);
143int timer_delete(timer_t timerid);
144int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value,
145 struct itimerspec *old_value);
146int timer_gettime(timer_t timerid, struct itimerspec *curr_value);
147int timer_getoverrun(timer_t timerid);
148
149/* POSIX clock CPU-time */
150int clock_getcpuclockid(pid_t pid, clockid_t *clock_id);
151
152/* POSIX timezone functions */
153void tzset(void);
154
155/* POSIX getdate (XSI) */
156struct tm *getdate(const char *string);
157extern int getdate_err;
158
159/* POSIX timezone variables */
160extern int daylight;
161extern long timezone;
162extern char *tzname[2];
163
static const twodig_t base
Definition bigint.cpp:28
Definition time.py:1
#define __ESBMC_C_CPP_END
Definition stddefs.h:9
#define __ESBMC_C_CPP_BEGIN
Definition stddefs.h:8
Definition time.h:78
struct timespec it_interval
Definition time.h:79
struct timespec it_value
Definition time.h:80
Definition time.h:69
long tv_nsec
Definition time.h:71
time_t tv_sec
Definition time.h:70
Definition time.h:14
Definition time.h:87
int tm_mon
Definition time.h:92
const char * tm_zone
Definition time.h:99
int tm_year
Definition time.h:93
int tm_hour
Definition time.h:90
int tm_sec
Definition time.h:88
int tm_isdst
Definition time.h:96
long tm_gmtoff
Definition time.h:98
int tm_yday
Definition time.h:95
int tm_mday
Definition time.h:91
int tm_min
Definition time.h:89
int tm_wday
Definition time.h:94
struct tm * gmtime_r(const time_t *timer, struct tm *buf)
Definition time.c:142
char * asctime(const struct tm *timeptr)
Definition time.c:213
char * ctime_r(const time_t *timer, char *buf)
Definition time.c:274
int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec *old_value)
Definition time.c:491
char * asctime_r(const struct tm *timeptr, char *buf)
Definition time.c:264
int clock_settime(clockid_t clk_id, const struct timespec *tp)
Definition time.c:368
struct tm * localtime_r(const time_t *timer, struct tm *buf)
Definition time.c:132
int clock_nanosleep(clockid_t clk_id, int flags, const struct timespec *request, struct timespec *remain)
Definition time.c:386
char * strptime(const char *s, const char *format, struct tm *tm)
Definition time.c:284
int nanosleep(const struct timespec *req, struct timespec *rem)
Definition time.c:425
int pid_t
Definition time.h:39
time_t timegm(struct tm *timeptr)
Definition time.c:189
char * tzname[2]
Definition time.c:451
double difftime(time_t end, time_t beginning)
Definition time.c:95
void * timer_t
Definition time.h:34
struct tm * localtime(const time_t *timer)
Definition time.c:112
int clock_getres(clockid_t clk_id, struct timespec *res)
Definition time.c:315
long clock_t
Definition time.h:24
struct tm * gmtime(const time_t *timer)
Definition time.c:122
int timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid)
Definition time.c:460
int clockid_t
Definition time.h:29
int timespec_get(struct timespec *ts, int base)
Definition time.c:249
int clock_gettime(clockid_t clk_id, struct timespec *tp)
Definition time.c:341
void tzset(void)
Definition time.c:570
int getdate_err
Definition time.c:454
long time_t
Definition time.h:17
int daylight
Definition time.c:449
size_t strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
Definition time.c:232
int timer_gettime(timer_t timerid, struct itimerspec *curr_value)
Definition time.c:522
int clock_getcpuclockid(pid_t pid, clockid_t *clock_id)
Definition time.c:552
struct tm * getdate(const char *string)
Definition time.c:581
int timer_delete(timer_t timerid)
Definition time.c:483
int timer_getoverrun(timer_t timerid)
Definition time.c:537
clock_t clock(void)
Definition time.c:105
char * ctime(const time_t *timer)
Definition time.c:222
time_t mktime(struct tm *timeptr)
Definition time.c:169