diff options
Diffstat (limited to 'include/posixtime.h')
-rw-r--r-- | include/posixtime.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/posixtime.h b/include/posixtime.h index 319cb168..a731b006 100644 --- a/include/posixtime.h +++ b/include/posixtime.h @@ -52,6 +52,15 @@ struct timeval extern int gettimeofday (struct timeval * restrict, void * restrict); #endif +/* consistently use gettimeofday for time information */ +static inline time_t +getnow(void) +{ + struct timeval now; + gettimeofday (&now, 0); + return now.tv_sec; +} + /* These exist on BSD systems, at least. */ #if !defined (timerclear) # define timerclear(tvp) do { (tvp)->tv_sec = 0; (tvp)->tv_usec = 0; } while (0) |