On Tue, Apr 17, 2012 at 4:06 PM, Brecht Ameije <[email protected]> wrote: > Hi, > I sent the message below before, but no response. > Maybe because it was in html instead of plain text? > Or am I the only one with this problem? > Brecht > > On 04/04/2012 14:56 Brecht Ameije wrote: >> >> Dear all, >> >> I'm trying to get the time zones right on my busybox embedded system. >> >> I'm in Belgium, this means we're on CET (UTC+1) and DST, thus UTC+2 At the >> moment of the tests below, my local time is 2:35PM. >> >> My embedded system has no persistent time storage. So I use ntp to fetch the >> time from the ntp pool. >> This gives me UTC time. Setting up the environment var TZ takes me to local >> time. >> >> When this is done, I set the hw clock to reflect my new system time. >> >> But now I come upon something strange: the "date -u" and the "hwclock -u" >> commands give different results: >> >> $ export TZ=CET-1CEST,M3.5.0/2,M10.5.0/3 >> $ ntpd -q -p 0.europe.pool.ntp.org # get current time >> $ hwclock -w # set hw clock >> $ date; date -u; hwclock; hwclock -u; hwclock -l >> Wed Apr 4 14:35:55 CEST 2012 >> Wed Apr 4 12:35:55 UTC 2012 >> Wed Apr 4 14:35:54 2012 0.000000 seconds >> Wed Apr 4 16:35:54 2012 0.000000 seconds >> Wed Apr 4 14:35:54 2012 0.000000 seconds
date -u means "show current time in UTC" whereas hwclock -u means "show rtc time in current timezone, assuming rtc clock is kept in UTC". Your rtc clock is kept in local time. Therefore "hwclock -u" will misinterpret it. -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
