This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 04/11] Use clock_settime to implement settimeofday.

25.10.2019 14:08 Adhemerval Zanella <> wrote:
> From: Zack Weinberg <>
> Use clock_settime to implement settimeofday.
> Changes from previous version:
>   - Added a NEWS entry.
> --
> [...]
> diff --git a/NEWS b/NEWS
> index 8727b5e7f0..0b1476e745 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -34,6 +34,30 @@ Deprecated and removed features, and other changes
> affecting compatibility:
>    binaries and it has been removed from <time.h> header.  This function
>    has been deprecated in favor of clock_settime.
> +* The settimeofday function can still be used to set a system-wide time
> +  zone when the operating system supports it.  This is because the Linux
> +  kernel reused the API, on some architectures, to describe a system-wide
> +  time-zone-like offset between the software clock maintained by the
> kernel,
> +  and the “RTC” clock that keeps time when the system is shut down.

That's little off-topic and little nit-picky but are you sure you want to
use the Unicode quotes like “” instead of plain ASCII "" ?  No problem if
this is what you really want but I suspect your editor converted this.

> +  However, to reduce the odds of this offset being set by accident,
> +  settimeofday can no longer be used to set the time and the offset
> +  simultaneously.  If both of its two arguments are non-null, the call
> +  will fail (setting errno to EINVAL).
> +
> +  Callers attempting to set this offset should also be prepared for the
> call
> +  to fail and set errno to ENOSYS; this already happens on the Hurd and
> on
> +  some Linux architectures.  The Linux kernel maintainers are discussing
> a
> +  more principled replacement for the reused API.  After a replacement
> +  becomes available, we will change settimeofday to fail with ENOSYS on
> all
> +  platforms when its ‘tzp’ argument is not a null pointer.

Same here, the Unicode ‘’ instead of plain ASCII '' .

> +  Note that settimeofday itself is obsolescent according to POSIX.
> +  Programs that set the system time should use clock_settime and/or
> +  the adjtime family of functions instead.  We may also cease to make
> +  settimeofday available to newly linked binaries after there is a
> +  replacement for Linux’s time-zone-like offset API.

Again the Unicode apostrophe ’ instead of plain ASCII ' .



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]