Merge branch 'sys-time-bits' into 'master'

move sys_time bits from C to cbindgen

See merge request redox-os/relibc!1129
This commit is contained in:
Jeremy Soller
2026-03-28 09:07:49 -06:00
2 changed files with 21 additions and 25 deletions
-23
View File
@@ -1,23 +0,0 @@
#ifndef _BITS_SYS_TIME
#define _BITS_SYS_TIME
#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)
#endif
+21 -2
View File
@@ -1,9 +1,28 @@
sys_includes = ["sys/types.h", "features.h", "sys/select.h"]
# sys/types.h brings in features.h (needed for #[deprecated] annotations)
sys_includes = ["sys/types.h", "sys/select.h"]
include_guard = "_SYS_TIME_H"
language = "C"
after_includes = """
#include <bits/time.h> // for timespec
#include <bits/sys/time.h>
#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