-/* Copyright (C) 1991,96,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <time.h>
+#include <time-clockid.h>
/* Return the time now, and store it in *TIMER if not NULL. */
time_t
-time (timer)
- time_t *timer;
+time (time_t *timer)
{
- __set_errno (ENOSYS);
+ struct timespec ts;
+ __clock_gettime (TIME_CLOCK_GETTIME_CLOCKID, &ts);
- if (timer != NULL)
- *timer = (time_t) -1;
- return (time_t) -1;
+ if (timer)
+ *timer = ts.tv_sec;
+ return ts.tv_sec;
}
-libc_hidden_def (time)
-
-stub_warning (time)