| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Earlier gettimeofday() was affected by discontinuous jumps. Measuring how
long time it takes to set time using function that effected by the very
thing being measured makes head spin. Lets make this less confusing with
monotonic clock that ticks on without jumps.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
| |
It's kernel business to return EINVAL for unsupported RTC_UIE_ON. We
(userspace) should not make decisions about things that we do not
control.
If kernel is wrong then fix the kernel, don't hide the problem by
crazy ifdefs in userspace.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
* add command line option --delay <seconds>
* read RTC type from /sys/class/rtc/rtc<N>/name
* default to 0.5 (500ms) for rtc_cmos or when RTC type is impossible
determine; otherwise delay is 0.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Warn on --debug; do not fallthrough because
the message is lost in the verbose output.
Coauthored-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
| |
This commit reverts 1d5cffa16a0183175684809cf215294ec20b8fd9.
(I did this revert manually as there was another changes in the code
and git-revert does not work in this case.)
Addresses: https://github.com/karelzak/util-linux/issues/543
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sysexits.h was introduced in v2.11t prior to util-linux-ng, with the
HISTORY entry: * hwclock: minor polishing.
So there was no specific issue solved by adding it. Its use was never
documented so it should be safe to remove.
Also, fix return values being used for the exit status that were not
magic constants (portability issue).
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
| |
The select() synchronization branch only returns success or
fail. There is no reason for the busywait branch to do more.
If synchronization fails for any reason then it must exit,
otherwise all drift correction operation will be invalid.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
| |
hwclock now exits on select(2) timeout so restore the warning.
Reverts commit ab8f402952301106ad0bd5c5a51dc8646d1bff64
and commit efc4eaf4229f78f14430d8739ddef2c5101f05cc
Except use warnx(), because select() timeout does not set errno.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Custom errno messages are unnecessary and problematic for translators.
The current messages are also too long, > 90 columns:
/dev/rtc0 does not have interrupt functions. Waiting in loop for time from \
/dev/rtc0 to change
Fixed:
ioctl(3, RTC_UIE_ON, 0): Inappropriate ioctl for device
Waiting in loop for time from /dev/rtc0 to change
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
| |
The rtc driver has not returned EINVAL for unimplemented ioctls since
v2.5.8 in 2002. However, it does return it for other errors; making the
current test potentially problematic. Since 9f3d0fc util-linux assumes
kernel >= 2.6.0 so remove EINVAL as an ioctl test.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
| |
warn() appends ENOENT as: No such file or directory
The custom string is unnecessary and problematic for translators.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
| |
Make consistent and improve messages in get_epoch_rtc()
and set_epoch_rtc().
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
| |
The epoch ioctls test hasn't been valid for 20 years (v2.1.88).
RTC has returned ENOTTY for unimplemented ioctls for 15 years.
The check is made for RTC_EPOCH_SET, but not for RTC_EPOCH_READ.
They were both implemented at the same time.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
hwclock --setepoch --epoch 0
Will warn that the epoch option is required.
The --epoch presence test is made on its argument after it is
converted to an integer. This means any value it can be tested
for, can also be given as an input.
So make the conversion after the presence test, like the
--date option does.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
| |
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 'silent' argument for get_epoch_rtc() was used
to silence error messages when querying the rtc
driver for an alpha epoch while using cmos direct
access. Alpha cmos has since been removed so
'silent' is no longer used.
* sys-utils/hwclock.h: remove 'silent' argument
* sys-utils/hwclock.c: same
* sys-utils/hwclock-rtc.c: same
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
| |
* sys-utils/hwclock-rtc.c: try to open the 'new' rtc class driver first.
* sys-utils/hwclock.8.in: document this.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
| |
Commit 27f9db17bd57b85947445c03e2cd9dda36ca377f missed a minus sign from
comparison.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
| |
The RTCGET and RTCSET are in use for sparcs with sbus, so try them as
fallback rather than always.
Reference: https://github.com/torvalds/linux/blob/master/fs/compat_ioctl.c#L967-L974
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
Flip if clauses to hit common case first. This should be easier and quicker
to read and run.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
| |
Make string constants to be symbolical declarations. Use longer variable
name for rtc and cmos function pointer values. Exclude code that is
architecture specific with preprocessor directives. And remove message
duplication.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
| |
Earlier when open_rtc() returned -1 the char *rtc_dev_name end up having
NULL that made it unsuitable to be used in error message. Now one can debug
what paths the open_rtc() tries to use when one has to debug why 'cannot
open rtc device' happen.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
| |
The manipulate_clock() is seeing return value from
busywait_for_rtc_clock_tick().
And the get_permissions_cmos() can see i386_iopl() return value.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use #ifdef rather than #if to avoid undefined preprocessor identifier
warning.
Remove dead code. The #if 0 ensured the code has not been used for long
time, which is good because the linux/mc146818rtc.h is not been part of
user-api for long time.
Value of the adjtime_p->last_calib_time is checked if it has value of zero,
so testing none-zero bit later is necessarily true, and therefore does not
need to be checked.
And at the and remove unnecessary boolean variable.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
| |
This makes main() a little bit shorter.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The control structure is read-only everywhere else but in main(). Almost
all changes are about how variables are referred, with one exception. Calls
to read_adjtime() from manipulate_clock() and compare_clock() are moved to
main(). This way it is possible to keep variable that tells if hwclock is
using UTC-0 be part of control structure.
Changes within #ifdef __alpha__ segments were tested by flipping the
preprocessor directivive otherway around and getting good compilaton all the
way to the point where linking on none-alpha system failed.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
| |
[sys-utils/hwclock-rtc.c:435]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'.
|
|
|
|
|
|
| |
Fix 'invalidPrintfArgType' cppcheck warnings
Signed-off-by: Boris Egorov <egorov@linux.com>
|
|
|
|
|
|
|
| |
Removes never used #ifdef dead code.
Reported-by: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
|
|
|
|
| |
Commit ab8f402952301106ad0bd5c5a51dc8646d1bff64 regression
where synchronize_to_clock_tick_rtc() only returns the correct
value for a select() time out if using debug mode. This caused
hwclock to have invalid output when select() timed out in
normal mode.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
|
|
|
|
|
|
| |
In addition, do it in a single sentence instead of in two fragments.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
Reported-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Sun, Sep 16, 2012 at 02:11:48PM +0800, Queen Adam wrote:
> I'm using Archlinux ARM for my Melo A100 box.
> The hwclock always timeout when using select() in rtc.c.
>
> After I change the timeout from 5 to 10, the problem is solved.
>
> In fact the timeout in my ARM box seems only to be a little larger
> than 5s.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|