From 317043010879767bc6a3bef6cbec0c5f300d1ce0 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Mon, 19 Oct 2020 13:54:31 +0300 Subject: sys: update to 6.8 --- sys/sys/time.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'sys/sys/time.h') diff --git a/sys/sys/time.h b/sys/sys/time.h index 564bae3..69e58e9 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.50 2020/01/15 13:17:35 mpi Exp $ */ +/* $OpenBSD: time.h,v 1.55 2020/07/06 13:33:09 pirofti Exp $ */ /* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */ /* @@ -163,7 +163,7 @@ struct clockinfo { }; #endif /* __BSD_VISIBLE */ -#if defined(_KERNEL) || defined(_STANDALONE) +#if defined(_KERNEL) || defined(_STANDALONE) || defined (_LIBC) #include /* Time expressed as seconds and fractions of a second + operations on it. */ @@ -171,6 +171,9 @@ struct bintime { time_t sec; uint64_t frac; }; +#endif + +#if defined(_KERNEL) || defined(_STANDALONE) || defined (_LIBC) #define bintimecmp(btp, ctp, cmp) \ ((btp)->sec == (ctp)->sec ? \ @@ -249,9 +252,9 @@ TIMEVAL_TO_BINTIME(const struct timeval *tv, struct bintime *bt) /* 18446744073709 = int(2^64 / 1000000) */ bt->frac = (uint64_t)tv->tv_usec * (uint64_t)18446744073709ULL; } +#endif -extern volatile time_t time_second; /* Seconds since epoch, wall time. */ -extern volatile time_t time_uptime; /* Seconds since reboot. */ +#if defined(_KERNEL) || defined(_STANDALONE) /* * Functions for looking at our clocks: [get]{bin,nano,micro}[boot|up]time() @@ -295,6 +298,12 @@ void binboottime(struct bintime *); void microboottime(struct timeval *); void nanoboottime(struct timespec *); +void binruntime(struct bintime *); +void nanoruntime(struct timespec *); + +time_t gettime(void); +time_t getuptime(void); + struct proc; int clock_gettime(struct proc *, clockid_t, struct timespec *); @@ -334,6 +343,13 @@ void clock_secs_to_ymdhms(time_t, struct clock_ymdhms *); #include +static inline void +USEC_TO_TIMEVAL(uint64_t us, struct timeval *tv) +{ + tv->tv_sec = us / 1000000; + tv->tv_usec = us % 1000000; +} + static inline void NSEC_TO_TIMEVAL(uint64_t ns, struct timeval *tv) { -- cgit v1.2.3