aboutsummaryrefslogtreecommitdiff
path: root/time/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/time.c')
-rw-r--r--time/time.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/time/time.c b/time/time.c
index b53a06e..e6e5eef 100644
--- a/time/time.c
+++ b/time/time.c
@@ -15,19 +15,18 @@
License along with the GNU C Library; if not, see
<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 (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)