projects
/
debian
/
gzip
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
delete trailing whitespace from control files
[debian/gzip]
/
lib
/
gettime.c
diff --git
a/lib/gettime.c
b/lib/gettime.c
index 8075bfaf999931af7e397777ce78b6b7637e7e40..bb59c44ff0e432349526646479da115d64cffc99 100644
(file)
--- a/
lib/gettime.c
+++ b/
lib/gettime.c
@@
-1,6
+1,6
@@
/* gettime -- get the system clock
/* gettime -- get the system clock
- Copyright (C) 2002, 2004-2007, 2009-201
2
Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004-2007, 2009-201
8
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-13,7
+13,7
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <http
s
://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
/* Written by Paul Eggert. */
@@
-28,21
+28,22
@@
void
gettime (struct timespec *ts)
{
void
gettime (struct timespec *ts)
{
-#if
HAVE_NANO
TIME
-
nanotime (
ts);
+#if
defined CLOCK_REALTIME && HAVE_CLOCK_GET
TIME
+
clock_gettime (CLOCK_REALTIME,
ts);
#else
#else
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = tv.tv_usec * 1000;
+#endif
+}
-# if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME
- if (clock_gettime (CLOCK_REALTIME, ts) == 0)
- return;
-# endif
-
- {
- struct timeval tv;
- gettimeofday (&tv, NULL);
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = tv.tv_usec * 1000;
- }
+/* Return the current system time as a struct timespec. */
-#endif
+struct timespec
+current_timespec (void)
+{
+ struct timespec ts;
+ gettime (&ts);
+ return ts;
}
}