1 /* Deprecated return date and time. Linux version.
2 Copyright (C) 1994-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 #include <sys/timeb.h>
25 __ftime64 (struct __timeb64
*timebuf
)
27 struct __timespec64 ts
;
28 __clock_gettime64 (CLOCK_REALTIME
, &ts
);
30 timebuf
->time
= ts
.tv_sec
;
31 timebuf
->millitm
= ts
.tv_nsec
/ 1000000;
32 timebuf
->timezone
= 0;
37 libc_hidden_def (__ftime64
)
40 ftime (struct timeb
*timebuf
)
42 struct __timeb64 tb64
;
44 if (! in_time_t_range (tb64
.time
))
46 __set_errno (EOVERFLOW
);
49 timebuf
->time
= tb64
.time
;
50 timebuf
->millitm
= tb64
.millitm
;
51 timebuf
->timezone
= tb64
.timezone
;
52 timebuf
->dstflag
= tb64
.dstflag
;