1#ifndef __SIMPLE_LIBC_TIME_H__
2#define __SIMPLE_LIBC_TIME_H__
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
7# if VSF_LINUX_USE_SIMPLE_LIBC == ENABLED
13# include "../sys/types.h"
15# include "../signal.h"
32#if VSF_LINUX_LIBC_CFG_WRAPPER == ENABLED
33#define clock_gettime VSF_LINUX_LIBC_WRAPPER(clock_gettime)
34#define clock_settime VSF_LINUX_LIBC_WRAPPER(clock_settime)
35#define clock_getres VSF_LINUX_LIBC_WRAPPER(clock_getres)
36#define clock_nanosleep VSF_LINUX_LIBC_WRAPPER(clock_nanosleep)
37#define timer_create VSF_LINUX_LIBC_WRAPPER(timer_create)
38#define timer_settime VSF_LINUX_LIBC_WRAPPER(timer_settime)
39#define timer_gettime VSF_LINUX_LIBC_WRAPPER(timer_gettime)
40#define timer_delete VSF_LINUX_LIBC_WRAPPER(timer_delete)
41#define timer_getoverrun VSF_LINUX_LIBC_WRAPPER(timer_getoverrun)
42#define nanosleep VSF_LINUX_LIBC_WRAPPER(nanosleep)
43#define clock VSF_LINUX_LIBC_WRAPPER(clock)
44#define timespec_get VSF_LINUX_LIBC_WRAPPER(timespec_get)
45#define strftime VSF_LINUX_LIBC_WRAPPER(strftime)
46#define strptime VSF_LINUX_LIBC_WRAPPER(strptime)
47#define tzset VSF_LINUX_LIBC_WRAPPER(tzset)
50#define TIMER_ABSTIME 1
89#if VSF_LINUX_APPLET_USE_LIBC_TIME == ENABLED
122# ifndef __VSF_APPLET__
127#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_LIBC_TIME_LIB__))\
128 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_LIBC_TIME == ENABLED
130#ifndef VSF_LINUX_APPLET_LIBC_TIME_VPLT
131# if VSF_LINUX_USE_APPLET == ENABLED
132# define VSF_LINUX_APPLET_LIBC_TIME_VPLT \
133 ((vsf_linux_libc_time_vplt_t *)(VSF_LINUX_APPLET_VPLT->libc_time_vplt))
135# define VSF_LINUX_APPLET_LIBC_TIME_VPLT \
136 ((vsf_linux_libc_time_vplt_t *)vsf_vplt((void *)0))
140#define VSF_LINUX_APPLET_LIBC_TIME_ENTRY(__NAME) \
141 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_LIBC_TIME_VPLT, __NAME)
142#define VSF_LINUX_APPLET_LIBC_TIME_IMP(...) \
143 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_LIBC_TIME_VPLT, __VA_ARGS__)
147 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
clock)();
151 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
clock_gettime)(clockid, ts);
155 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
clock_settime)(clockid, ts);
159 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
clock_getres)(clockid, res);
163 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
clock_nanosleep)(clockid, flags, request, remain);
167 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
time)(t);
171 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
difftime)(time1, time2);
173VSF_LINUX_APPLET_LIBC_TIME_IMP(
asctime,
char *,
const struct tm *
tm) {
175 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
asctime)(
tm);
177VSF_LINUX_APPLET_LIBC_TIME_IMP(
asctime_r,
char *,
const struct tm *
tm,
char *buf) {
179 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
asctime_r)(
tm, buf);
181VSF_LINUX_APPLET_LIBC_TIME_IMP(
ctime,
char *,
const time_t *t) {
183 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
ctime)(t);
185VSF_LINUX_APPLET_LIBC_TIME_IMP(
ctime_r,
char *,
const time_t *t,
char *buf) {
187 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
ctime_r)(t, buf);
189VSF_LINUX_APPLET_LIBC_TIME_IMP(
gmtime,
struct tm *,
const time_t *t) {
191 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
gmtime)(t);
193VSF_LINUX_APPLET_LIBC_TIME_IMP(
gmtime_r,
struct tm *,
const time_t *t,
struct tm *result) {
195 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
gmtime_r)(t, result);
199 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
localtime)(t);
203 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
localtime_r)(t, result);
207 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
mktime)(
tm);
209VSF_LINUX_APPLET_LIBC_TIME_IMP(
strftime,
size_t,
char *str,
size_t maxsize,
const char *
format,
const struct tm *
tm) {
211 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
strftime)(str, maxsize,
format,
tm);
213VSF_LINUX_APPLET_LIBC_TIME_IMP(
strptime,
char *,
const char *str,
const char *
format,
struct tm *
tm) {
219 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
nanosleep)(requested_time, remaining);
223 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
timer_create)(clockid, sevp, timerid);
227 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
timer_delete)(timerid);
231 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
timer_settime)(timerid, flags, new_value, old_value);
235 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
timer_gettime)(timerid, curr_value);
239 return VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
timespec_get)(ts, base);
241VSF_LINUX_APPLET_LIBC_TIME_IMP(
tzset,
void,
void) {
243 VSF_LINUX_APPLET_LIBC_TIME_ENTRY(
tzset)();
__CLOCK_T clock_t
Definition types.h:132
clockid_t
Definition types.h:138
void * timer_t
Definition types.h:104
__TIME64_T time64_t
Definition types.h:127
__TIME_T time_t
Definition types.h:122
#define clock_nanosleep
Definition time.h:36
struct tm * gmtime(const time_t *t)
Definition vsf_linux_glibc_time.c:338
double difftime(time_t time1, time_t time2)
char * asctime_r(const struct tm *tm, char *buf)
Definition vsf_linux_glibc_time.c:266
#define clock_getres
Definition time.h:35
#define timer_getoverrun
Definition time.h:41
char * tzname[2]
Definition vsf_linux_glibc_time.c:44
struct tm * localtime_r(const time_t *t, struct tm *result)
Definition vsf_linux_glibc_time.c:343
#define clock_gettime
Definition time.h:33
struct tm * localtime(const time_t *t)
Definition vsf_linux_glibc_time.c:348
#define clock_settime
Definition time.h:34
#define clock
Definition time.h:43
#define tzset
Definition time.h:47
char * ctime(const time_t *t)
Definition vsf_linux_glibc_time.c:278
#define timer_create
Definition time.h:37
int daylight
Definition vsf_linux_glibc_time.c:46
long timezong
Definition vsf_linux_glibc_time.c:45
char * ctime_r(const time_t *t, char *buf)
Definition vsf_linux_glibc_time.c:283
#define nanosleep
Definition time.h:42
#define timer_delete
Definition time.h:40
#define timer_settime
Definition time.h:38
#define timer_gettime
Definition time.h:39
#define strftime
Definition time.h:45
struct tm * gmtime_r(const time_t *t, struct tm *result)
Definition vsf_linux_glibc_time.c:288
__VSF_VPLT_DECORATOR__ vsf_linux_libc_time_vplt_t vsf_linux_libc_time_vplt
Definition vsf_linux_glibc_time.c:635
time_t time(time_t *t)
Definition vsf_linux_glibc_time.c:89
#define strptime
Definition time.h:46
char * asctime(const struct tm *tm)
Definition vsf_linux_glibc_time.c:271
time_t mktime(struct tm *tm)
Definition vsf_linux_glibc_time.c:70
#define timespec_get
Definition time.h:44
struct timespec64 it_interval
Definition time.h:85
struct timespec64 it_value
Definition time.h:86
struct timespec it_interval
Definition time.h:72
struct timespec it_value
Definition time.h:73
time64_t tv_sec
Definition time.h:77
long tv_nsec
Definition time.h:78
long tv_nsec
Definition time.h:68
time_t tv_sec
Definition time.h:67
int tm_mon
Definition time.h:57
const char * tm_zone
Definition time.h:63
int tm_year
Definition time.h:58
int tm_hour
Definition time.h:55
int tm_sec
Definition time.h:53
int tm_isdst
Definition time.h:61
int tm_yday
Definition time.h:60
long int tm_gmtoff
Definition time.h:62
int tm_mday
Definition time.h:56
int tm_min
Definition time.h:54
int tm_wday
Definition time.h:59
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(timespec_get)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(nanosleep)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(gmtime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ctime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(timer_gettime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(asctime_r)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(timer_getoverrun)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(clock_settime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(clock_getres)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(clock_nanosleep)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(timer_delete)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(timer_settime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(timer_create)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mktime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(strptime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(localtime_r)
vsf_vplt_info_t info
Definition time.h:91
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(gmtime_r)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tzset)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(clock)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(difftime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(asctime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(strftime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(clock_gettime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(localtime)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(time)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ctime_r)
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165