diff options
author | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2017-09-08 00:41:59 +0200 |
---|---|---|
committer | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2018-10-24 12:53:27 +0200 |
commit | 2ea80487a743e78a2f0c8962ec2d4837e9c0a8d0 (patch) | |
tree | 504f3d1ad7cbeeab2bb85a6248140afb25993652 /sysdeps/unix | |
parent | 3f87e785beefd9966f386518db69a010af1ea7b0 (diff) | |
download | glibc-2ea80487a743e78a2f0c8962ec2d4837e9c0a8d0.zip glibc-2ea80487a743e78a2f0c8962ec2d4837e9c0a8d0.tar.gz glibc-2ea80487a743e78a2f0c8962ec2d4837e9c0a8d0.tar.bz2 |
Y2038: add function __settimeofday64
Implementing a 64-bit settimeofday requires adding a new
file to build under time/ and we cannot name that new file
'settimeofday.c' or it will break the 32-bit settimeofday
file symbol, so we call it 'settimeofday64.c'.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/settimeofday64.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/settimeofday64.c b/sysdeps/unix/sysv/linux/settimeofday64.c new file mode 100644 index 0000000..1a9fa23 --- /dev/null +++ b/sysdeps/unix/sysv/linux/settimeofday64.c @@ -0,0 +1,39 @@ +/* Set the current time of day and timezone information. + + Copyright (C) 2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + 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/>. */ + +#include <sysdep.h> +#include <errno.h> +#include <sys/time.h> + +int __settimeofday64(const struct __timeval64 *tv, + const struct timezone *tz) +{ + struct timeval tv32; + + if (tv && tv->tv_sec > INT_MAX) + { + __set_errno(EOVERFLOW); + return -1; + } + + tv32.tv_sec = tv->tv_sec; + tv32.tv_usec = tv->tv_usec; + + return __settimeofday(&tv32, tz); +} |