Files
RedBear-OS/src/header/sys_time/cbindgen.toml
T
2026-06-01 10:34:39 +01:00

46 lines
1.7 KiB
TOML

# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_time.h.html
#
# Spec quotations relating to includes:
# - "The <sys/time.h> header shall define the fd_set type and the timeval structure, as described in <sys/select.h>."
# - "The <sys/time.h> header shall define the time_t and suseconds_t types as described in <sys/types.h>."
# - "The <sys/time.h> header shall define the following as described in <sys/select.h>: FD_CLR() FD_ISSET() FD_SET() FD_ZERO() FD_SETSIZE"
# - "Inclusion of the <sys/time.h> header may make visible all symbols from the <sys/select.h> header."
#
# sys/select brings in bits/timeval.h
# bits/timeval.h brings in time_t and suseconds_t
# features.h needed for deprecated annotations
sys_includes = ["sys/select.h", "features.h"]
include_guard = "_RELIBC_SYS_TIME_H"
language = "C"
after_includes = """
#define timeradd(x,y,res) (void) (\
(res)->tv_sec = (x)->tv_sec + (y)->tv_sec + (((x)->tv_usec + (y)->tv_usec) / 1000000), \
(res)->tv_usec = ((x)->tv_usec + (y)->tv_usec) % 1000000 \
)
#define timersub(x,y,res) (void) ( \
(res)->tv_sec = (x)->tv_sec - (y)->tv_sec, \
(res)->tv_usec = ((x)->tv_usec - (y)->tv_usec), \
((res)->tv_usec < 0) && ((res)->tv_sec -= 1, (res)->tv_usec += 1000000) \
)
#define timerclear(t) (void) ( \
(t)->tv_sec = 0, \
(t)->tv_usec = 0 \
)
#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
#define timercmp(x,y,op) ((x)->tv_sec == (y)->tv_sec ? \
(x)->tv_usec op (y)->tv_usec \
: \
(x)->tv_sec op (y)->tv_sec)
"""
style = "Tag"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
[export.rename]
"timespec" = "struct timespec"
"timeval" = "struct timeval"