1 /* settimeofday -- set system time - Linux version supporting 64 bit time.
2 Copyright (C) 2020-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/>. */
23 /* Set the current time of day and timezone information.
24 This call is restricted to the super-user. */
26 __settimeofday64 (const struct __timeval64
*tv
, const struct timezone
*tz
)
28 /* Backwards compatibility for setting the UTC offset. */
29 if (__glibc_unlikely (tz
!= 0))
36 return __settimezone (tz
);
39 struct __timespec64 ts
= timeval64_to_timespec64 (*tv
);
40 return __clock_settime64 (CLOCK_REALTIME
, &ts
);
44 libc_hidden_def (__settimeofday64
)
47 __settimeofday (const struct timeval
*tv
, const struct timezone
*tz
)
49 if (__glibc_unlikely (tv
== NULL
))
50 return __settimeofday64 (NULL
, tz
);
53 struct __timeval64 tv64
= valid_timeval_to_timeval64 (*tv
);
54 return __settimeofday64 (&tv64
, tz
);
58 weak_alias (__settimeofday
, settimeofday
);