x86: In ld.so, diagnose missing APX support in APX-only builds
[glibc.git] / sysdeps / unix / sysv / linux / ftime.c
blob06b0f3db05cd36e58f7a2f103b6631cbb160321a
1 /* Deprecated return date and time. Linux version.
2 Copyright (C) 1994-2024 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/>. */
19 #include <features.h>
20 #include <sys/timeb.h>
21 #include <time.h>
22 #include <errno.h>
24 int
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;
33 timebuf->dstflag = 0;
34 return 0;
36 #if __TIMESIZE != 64
37 libc_hidden_def (__ftime64)
39 int
40 ftime (struct timeb *timebuf)
42 struct __timeb64 tb64;
43 __ftime64 (&tb64);
44 if (! in_time_t_range (tb64.time))
46 __set_errno (EOVERFLOW);
47 return -1;
49 timebuf->time = tb64.time;
50 timebuf->millitm = tb64.millitm;
51 timebuf->timezone = tb64.timezone;
52 timebuf->dstflag = tb64.dstflag;
53 return 0;
55 #endif