public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* Discussion on BIOS/CMOS/UEFI clock in local time
@ 2013-02-14 12:30 Dr. Werner Fink
  2013-02-22 10:31 ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Dr. Werner Fink @ 2013-02-14 12:30 UTC (permalink / raw)
  To: Util-Linux

Hi,

just before such a discussion I'd like to point the mail

     https://lkml.org/lkml/2008/1/12/87

from Ted Ts'o in the mail thread

     https://lkml.org/lkml/2008/1/8/195

In this mail he advises to set set the system clock before running
e2fsck on an ext3 and higher file system to avoid wrong timestamps.

As this problem can also occur with other journaling file systems
the way to avoid this is to correct the kernels assumption that the
BIOS/CMOS clock is running in UTC by using the the system call
settimeofday(2) with the tz_minuteswest field of the timezone
structure.

This may done with the hwclock option --systz or here with the
small warpclock utility in the initrd/initramfs.  Now with the UEFI
specs (section 7.3) the local time will become more often the default
for the BIOS/CMOS clock.

This will raise twice a year the problem if or if the HW clock has
been corrected for DST on/off by the user or an other OS like Windows[tm].
First case requires to ask the user if or if the DST offset has been
corrected.  Whereas in the second case I do not know where the other
OS stores its information about DST on/off.

With UEFI this could be solved as the EFI BIOS shows DST and TIMEZONE
entries.  But AFAICS from the kernels source (3.7) the timezone is
simply ignored, compare with drivers/rtc/rtc-efi.c as well as with
drivers/char/efirtc.c in the functions convert_to_efi_time() and
convert_from_efi_time() ...  also for the user space tools there
is no API to change e.g. the DST flag.


    Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Discussion on BIOS/CMOS/UEFI clock in local time
  2013-02-14 12:30 Discussion on BIOS/CMOS/UEFI clock in local time Dr. Werner Fink
@ 2013-02-22 10:31 ` Karel Zak
  2013-02-22 12:01   ` Alessandro Zummo
  0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2013-02-22 10:31 UTC (permalink / raw)
  To: Util-Linux; +Cc: Alessandro Zummo, rtc-linux

On Thu, Feb 14, 2013 at 01:30:47PM +0100, Dr. Werner Fink wrote:
> just before such a discussion I'd like to point the mail
> 
>      https://lkml.org/lkml/2008/1/12/87
> 
> from Ted Ts'o in the mail thread
> 
>      https://lkml.org/lkml/2008/1/8/195
> 
> In this mail he advises to set set the system clock before running
> e2fsck on an ext3 and higher file system to avoid wrong timestamps.
> 
> As this problem can also occur with other journaling file systems
> the way to avoid this is to correct the kernels assumption that the
> BIOS/CMOS clock is running in UTC by using the the system call
> settimeofday(2) with the tz_minuteswest field of the timezone
> structure.
> 
> This may done with the hwclock option --systz or here with the
> small warpclock utility in the initrd/initramfs.  Now with the UEFI
> specs (section 7.3) the local time will become more often the default
> for the BIOS/CMOS clock.
> 
> This will raise twice a year the problem if or if the HW clock has
> been corrected for DST on/off by the user or an other OS like Windows[tm].
> First case requires to ask the user if or if the DST offset has been
> corrected.  Whereas in the second case I do not know where the other
> OS stores its information about DST on/off.
> 
> With UEFI this could be solved as the EFI BIOS shows DST and TIMEZONE
> entries.  But AFAICS from the kernels source (3.7) the timezone is
> simply ignored, compare with drivers/rtc/rtc-efi.c as well as with
> drivers/char/efirtc.c in the functions convert_to_efi_time() and
> convert_from_efi_time() ...  also for the user space tools there
> is no API to change e.g. the DST flag.

 That's cool news. Thanks.

 It seems that kernel CONFIG_RTC_HCTOSYS code should be improved to use
 the information from UEFI rather than blindly assume that HW clock is 
 always in UTC. I don't see a reason to try to fix this in userspace as
 we use (or we want:-) CONFIG_RTC_HCTOSYS almost everywhere.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Discussion on BIOS/CMOS/UEFI clock in local time
  2013-02-22 10:31 ` Karel Zak
@ 2013-02-22 12:01   ` Alessandro Zummo
  0 siblings, 0 replies; 3+ messages in thread
From: Alessandro Zummo @ 2013-02-22 12:01 UTC (permalink / raw)
  To: Karel Zak; +Cc: Util-Linux, rtc-linux

On Fri, 22 Feb 2013 11:31:03 +0100
Karel Zak <kzak@redhat.com> wrote:

>  That's cool news. Thanks.
> 
>  It seems that kernel CONFIG_RTC_HCTOSYS code should be improved to use
>  the information from UEFI rather than blindly assume that HW clock is 
>  always in UTC. I don't see a reason to try to fix this in userspace as
>  we use (or we want:-) CONFIG_RTC_HCTOSYS almost everywhere.

 It seems reasonable to me ;)

p.s.
 
 Even if I'd just force everyone to use UTC... :)

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-22 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 12:30 Discussion on BIOS/CMOS/UEFI clock in local time Dr. Werner Fink
2013-02-22 10:31 ` Karel Zak
2013-02-22 12:01   ` Alessandro Zummo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox