On Wednesday 05 December 2007, Karel Zak wrote:
> Applied, thanks.
And for the record ... see the appended, which I needed to get this
to work on an Ubuntu Feisty system (dual booting XP, so that the RTC
must match wall-clock time). That was the reason I ended up looking
at this code again ... :)
I'm not currently submitting this, since I've not had time to test
this the ARM systems with the suspect uClibc version. I'd like to
understand a bit better how this bug arrived in the first place.
- Dave
========== CUT HERE
Bugfix for rtcwake in util-linux-ng-2.13.0.1:
Timezone handling is broken in this version since it's always
passing UTC time into the kernel, even on systems where the
RTC uses the local timezone.
I think that bug must come from bugs in the version of uClibc
which was originally used to develop this code.
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
sys-utils/rtcwake.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--- util-linux-ng-2.13.0.1.orig/sys-utils/rtcwake.c 2007-11-30
13:33:33.000000000 -0800
+++ util-linux-ng-2.13.0.1/sys-utils/rtcwake.c 2007-11-30 13:33:38.000000000
-0800
@@ -187,7 +187,17 @@ static int setup_alarm(int fd, time_t *w
struct tm *tm;
struct rtc_wkalrm wake;
- tm = gmtime(wakeup);
+ /* The wakeup time is in POSIX time (more or less UTC).
+ * Ideally RTCs use that same time; but PCs can't do that
+ * if they need to boot MS-Windows. Messy...
+ *
+ * When clock_mode == CM_UTC this process's timezone is UTC,
+ * so we'll pass a UTC date to the RTC.
+ *
+ * Else clock_mode == CM_LOCAL so the time given to the RTC
+ * will instead use the local time zone.
+ */
+ tm = localtime(wakeup);
wake.time.tm_sec = tm->tm_sec;
wake.time.tm_min = tm->tm_min;
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html