mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
time: implement timespec_to_timeval()
This commit is contained in:
@@ -57,4 +57,12 @@ static inline bool timespec_bigger(timespec_t t1, timespec_t t2) {
|
||||
return t1.s > t2.s || (t1.s == t2.s && t1.ns > t2.ns);
|
||||
}
|
||||
|
||||
static inline timeval_t timespec_to_timeval(timespec_t ts) {
|
||||
timeval_t tv = {
|
||||
ts.s,
|
||||
ts.ns / 1000
|
||||
};
|
||||
return tv;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user