Commit graph

20 commits

Author SHA1 Message Date
Karel Zak
27f9db17bd hwclock: don't open /dev/rtc repeatedly
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-18 14:08:57 +02:00
Karel Zak
55a4a75ca0 hwclock: read_hardware_clock_rtc() need to return error codes
We shouldn't ignore RTC_RD_TIME/RTCGET error codes.

Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-13 11:47:10 +02:00
Karel Zak
982a4a5d98 hwclock: use time limit for synchronization busy wait
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-08-13 11:43:59 +02:00
David Brownell
442d61c6e9 hwclock: remove x86_64-specific bogon
I was puzzled why "hwclock" wrongly reported my x86_64 sytem didn't
support RTC update interrupts.  Bogus #ifdef, that's why ... added
by the 2.11y patch (from 2.11t).  Probably this whole #ifdef should
just vanish ... if the kernel rejects UIE_ON, the program ought to
just cope with it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2008-08-12 12:50:11 +02:00
Karel Zak
cdedde039c hwclock: always reads hardware clock
It's a pity that hwclock first tries to read the clock when running

	hwclock --systohc --noadjfile --utc

and exits as this fails.  I cannot see a reason to read first in that
case.

Old version:

	# hwclock --systohc --noadjfile --utc --debug

	hwclock from util-linux-ng 2.14
	Using /dev interface to clock.
	Assuming hardware clock is kept in UTC time.
	Waiting for clock tick...
	/dev/rtc does not have interrupt functions. Waiting in loop for time
	from /dev/rtc to change
	...got clock tick
	Time read from Hardware Clock: 2008/06/17 11:18:24
	Hw clock time : 2008/06/17 11:18:24 = 1213701504 seconds since 1969
	Time elapsed since reference time has been 0.904855 seconds.
	Delaying further to reach the next full second.
	Setting Hardware Clock to 11:18:24 = 1213701504 seconds since 1969
	ioctl(RTC_SET_TIME) was successful.

New version:

	# hwclock --systohc --noadjfile --utc --debug

	hwclock from util-linux-ng 2.14
	Using /dev interface to clock.
	Assuming hardware clock is kept in UTC time.
	Time elapsed since reference time has been 0.572151 seconds.
	Delaying further to reach the next full second.
	Setting Hardware Clock to 11:18:52 = 1213701532 seconds since 1969
	ioctl(RTC_SET_TIME) was successful.

Addresses-Debian-Bug: #478663
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-06-17 13:19:18 +02:00
David Woodhouse
df1d7dcf1e hwclock: check for ENODEV
/sbin/hwclock is supposed to fall back to using /dev/rtc0 if /dev/rtc isn't
working (which it isn't, because mkinitrd creates it with the old device
numbers, and we're switching to the new RTC_CLASS driver).

Unfortunately, it'll only cope if the error it gets is ENOENT (i.e. the device
node doesn't exist). It doesn't fall back to the next device in the list if the
error is ENODEV, which is what happens when the device node exists, but there's
no driver.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-12-04 14:44:05 +01:00
Matthias Koenig
5d1f6bae3b hwclock: fix --rtc option
The --rtc option does not set the name of the device correctly.
It still uses /dev/rtc even if the --rtc option is given.

Testcase:
$ mv /dev/rtc /dev/foo
$ hwclock --show --debug --rtc=/dev/foo
hwclock from util-linux-2.13-rc2
Using /dev interface to clock.
Last drift adjustment done at 1190198135 seconds after 1969
Last calibration done at 1190198135 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
...got clock tick

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-09-20 13:40:14 +02:00
Karel Zak
9abb26854c hwclock: remove tailing white-spaces and clean up clock.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 15:05:58 +01:00
Karel Zak
88058a71e2 hwclock: add support for audit system
If you compile --with-audit the hwclock tool reports changes in sys/hw clock to
audit system. The real long-term and final solution is probably add hooks for
/dev/rtc to kernel, but it's not implemented yet.

Signed-off-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 14:12:05 +01:00
Karel Zak
88681c5f1a hwclock: add --rtc=<path> option and support for /dev/rtc0
The patch to allow "hwclock --rtc /dev/rtc1" and so on,
since "/dev/rtc" may not be there and "/dev/rtc0" may not be
the right answer either.

The "--rtc" is compatible with next Bryan Henderson's hwclock
versions.

Signed-off-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-19 10:14:13 +01:00
Karel Zak
48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak
5213517f54 Imported from util-linux-2.12l tarball. 2006-12-07 00:26:28 +01:00
Karel Zak
d03dd60840 Imported from util-linux-2.12a tarball. 2006-12-07 00:26:14 +01:00
Karel Zak
df1dddf9ff Imported from util-linux-2.12 tarball. 2006-12-07 00:26:12 +01:00
Karel Zak
a5a16c6853 Imported from util-linux-2.11y tarball. 2006-12-07 00:26:08 +01:00
Karel Zak
95f1bdeee4 Imported from util-linux-2.11x tarball. 2006-12-07 00:26:05 +01:00
Karel Zak
63cccae468 Imported from util-linux-2.11t tarball. 2006-12-07 00:25:58 +01:00
Karel Zak
364cda4857 Imported from util-linux-2.11f tarball. 2006-12-07 00:25:48 +01:00
Karel Zak
c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak
66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Renamed from clock/rtc.c (Browse further)