Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settimeofday is deprecated #957

Closed
zqqw opened this issue Feb 15, 2020 · 4 comments
Closed

settimeofday is deprecated #957

zqqw opened this issue Feb 15, 2020 · 4 comments

Comments

@zqqw
Copy link

zqqw commented Feb 15, 2020

@karelzak
Copy link
Collaborator

More references:
systemd: systemd/systemd#13305

@zqqw
Copy link
Author

zqqw commented Feb 18, 2020

Some server software I know of checks in preference 1) NTP 2) Local time reference 3) The server's own RTC at boot to set the OS time, so hwclock or something similar is still useful there for scripting the logic.

@2005songliwei
Copy link

2005songliwei commented Feb 19, 2020

I also met the same issue when update glibc to 2.31 by run hwclock -s
$ hwclock -s
hwclock: settimeofday() failed: Invalid argument

karelzak added a commit that referenced this issue Feb 19, 2020
glibc announce:
  ... 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).

It means we need to call settimeofday(NULL, tz) and settimeofday(tv, NULL).

Unfortunately, settimeofday(NULL, tz) has very special warp-clock
semantic if used as the very first settimeofday() call. It means we
have to be sure that we do not touch warp-clock if we need only need
to modify system TZ. So, let's always call settimeofday(NULL, 0)
before settimeofday(NULL, tz) for UTC rtc mode when modify system TZ.

CC: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Addresses: #957
@karelzak
Copy link
Collaborator

The version merged to master branch: cd781c4

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants