time: introduce a new timespec_ns helper

This just returns the total number of elapsed nanoseconds given a
timespec struct.
This commit is contained in:
8infy
2024-09-01 19:43:01 +03:00
parent f306edb5ec
commit 1042c1b1b0
+4
View File
@@ -35,4 +35,8 @@ static inline time_t timespec_diffus(timespec_t a, timespec_t b) {
return nsecdiff / 1000 + secdiff * 1000000;
}
static inline time_t timespec_ns(timespec_t a) {
return a.ns + a.s * 1000000000;
}
#endif