[PATCH] ignore RTC's notion of DST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi --

several people have noticed a problem with rtcwake on recent
releases built for the XO laptop.  as it happens, the symptoms
exactly match this recently-reported debian bug:
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539347

i believe the issue is that rtcwake honors tm_isdst as returned
from the RTC (whose value on the XO is 0), and this incorrectly
influences the result of mktime.  i suspect that the system's
knowledge of DST will usually be more correct than that of the
RTC, and so the RTC's notion should be ignored.

i've tested this with both -s and -t alarm setting options, and it
seems to do the right thing.

(a workaround, at least for the -s "relative time" case, is
simply to pass "--utc" on the rtcwake commandline.  it's arguable
that rtcwake should ignore timezones when -s is used in any
case.)

paul


commit c0541b637ac9717cb931cb7ea0847756b618932c
Author: Paul Fox <pgf@xxxxxxxxxx>
Date:   Thu Aug 13 10:50:50 2009 -0400

    ignore the tm_isdst field returned from the RTC, since we don't use
    it when setting the alarm time.
    
    Signed-off-by: Paul Fox <pgf@xxxxxxxxxx>

diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 4b84373..105f5dd 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -156,7 +156,7 @@ static int get_basetimes(int fd)
 	tm.tm_mday = rtc.tm_mday;
 	tm.tm_mon = rtc.tm_mon;
 	tm.tm_year = rtc.tm_year;
-	tm.tm_isdst = rtc.tm_isdst;	/* stays unspecified? */
+	tm.tm_isdst = -1;  /* assume the system knows better than the RTC */
 	rtc_time = mktime(&tm);
 
 	if (rtc_time == (time_t)-1) {


=---------------------
 paul fox, pgf@xxxxxxxxxx
--
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

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux