From eacc876c76a3e4bf6f3b033ed072701d7c27e575 Mon Sep 17 00:00:00 2001 From: Zijun Zhao Date: Mon, 5 Jun 2023 11:45:49 -0700 Subject: gettimeofday.2: Add details about the nullability of tv in different libc's tv arg is allowed to be NULL in bionic. POSIX says this behavior is undefined, and bionic just exposes the Linux syscall directly. There's no code in bionic for gettimeofday/settimeofday; just a description of the syscall name and arguments from which an assembler stub is automatically generated at build time. musl and glibc go out of their way to behave differently from the Linux kernel, but no idea why. Signed-off-by: Zijun Zhao Cc: Elliott Hughes Signed-off-by: Alejandro Colomar --- man2/gettimeofday.2 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/man2/gettimeofday.2 b/man2/gettimeofday.2 index 9d134fa49..7c2892315 100644 --- a/man2/gettimeofday.2 +++ b/man2/gettimeofday.2 @@ -175,6 +175,17 @@ On some architectures, an implementation of .BR gettimeofday () is provided in the .BR vdso (7). +.PP +The kernel accepts NULL for both +.I tv +and +.IR tz. +The timezone argument is ignored by glibc and musl, +and not passed to/from the kernel. +Android's bionic passes the timezone argument to/from the kernel, +but Android does not update the kernel timezone +based on the device timezone in Settings, +so the kernel's timezone is typically UTC. .SH STANDARDS .TP .BR gettimeofday () -- cgit v1.2.3