On Tue, Aug 12, 2008 at 03:15:18PM +0200, Tomasz Chmielewski wrote: > Karel Zak schrieb: > > (...) > >>> The patch is below. It's based on gettimeofday() rather than on >>> SIGALRM (alarm(2)). The gettimeofday has some overhead, but it >>> shouldn't be a big problem for the synchronization function (... and >>> it's fallback for systems without RTC_UIE_ON). >>> >>> Please, test & review. I'd like to use the patch in 2.14.1. > > It does not "hang" anymore: > > # ./hwclock --show > Timed out waiting for time change. Cool. > But still, it won't set the hardware clock so it can start ticking: > > # date > Tue Aug 12 13:13:59 UTC 2008 > # ./hwclock --systohc > Timed out waiting for time change. Yes, I know. See below. Sorry, I hope you have all my patches now. Karel >From 5bd30176f33fb03632c5381826fde92b9094dcf4 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@xxxxxxxxxx> Date: Sat, 9 Aug 2008 01:22:08 +0200 Subject: [PATCH] hwclock: clean up return codes * don't check synchronize_to_clock_tick() return code. It seem that rtc-isl1208 0-006f: chip found, driver version 0.3 rtc-isl1208 0-006f: rtc core: registered rtc-isl1208 as rtc0 rtc-isl1208 0-006f: rtc power failure detected, please set clock. causes that hardware clock returns persistent time and synchronization is impossible. The hwclock(8) has to ignore this problem and allows to set clock anyway. * read_hardware_clock_rtc() should to return proper code (-1) in case of ioctl failure. * synchronize_to_clock_tick() shouldn't to print the "...got clock tick" debug message in case of failure. Signed-off-by: Karel Zak <kzak@xxxxxxxxxx> --- hwclock/hwclock.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c index 12e7676..0b30a90 100644 --- a/hwclock/hwclock.c +++ b/hwclock/hwclock.c @@ -352,7 +352,12 @@ synchronize_to_clock_tick(void) { rc = ur->synchronize_to_clock_tick(); - if (debug) printf(_("...got clock tick\n")); + if (debug) { + if (rc) + printf(_("...synchronization failed\n")); + else + printf(_("...got clock tick\n")); + } return rc; } @@ -1092,9 +1097,7 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, if (show || adjust || hctosys || !noadjfile) { /* data from HW-clock are required */ - rc = synchronize_to_clock_tick(); - if (rc) - return EX_IOERR; + synchronize_to_clock_tick(); gettimeofday(&read_time, NULL); rc = read_hardware_clock(universal, &hclock_valid, &hclocktime); if (rc) -- 1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html