summaryrefslogtreecommitdiff
path: root/posixtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'posixtime.h')
-rw-r--r--posixtime.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/posixtime.h b/posixtime.h
index e70ebec..a731b00 100644
--- a/posixtime.h
+++ b/posixtime.h
@@ -1,6 +1,6 @@
/* posixtime.h -- wrapper for time.h, sys/times.h mess. */
-/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -49,9 +49,18 @@ struct timeval
#endif
#if !HAVE_GETTIMEOFDAY
-extern int gettimeofday PARAMS((struct timeval *, void *));
+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)