daniele pendenza wrote: > So I think this is the general picture : > 1 - when the system starts the value of the system time is defined > taking into account the value of the RTC time the value of the UTC > constant retrived at startup and the timezone information. > 2 - when the system is up and running the system time is "the time that > matters" - as you said - and, when requested, it is presented to users > after the "timezone shift" eventually. > 3 - when the system is shutdown the system time is _saved_ after > calculations based on the same informations as in line 1.
All correct. > If all that I wrote is correct : why the command ' hwclock --show > --localtime' shows me the UTC time and 'hwclock --show --utc' shows me > the localtime ? The --utc and --localtime options are not to affect the display but to configure how hwclock reads time from the hardware clock. Those options tell hwclock whether the hardware clock is kept in UTC or in localtime. The --show always displays in localtime. --show Read the Hardware Clock and print the time on Standard Output. The time shown is always in local time, even if you keep your Hardware Clock in Coordinated Universal Time. See the --utc option. > I set up UTC=yes and the timezone is Europe/Rome and I don't have > windows... uh Then hwclock --utc would be the correct option for you since the hardware clock is set to UTC. If you use --localtime then hwclock will wrongy think that the hardware clock is in local time and apply an undesired correction factor. Generally userland applications should use date instead of hwclock to get time information. The hardware clock interface will be slower and more resource intensive because this is through the kernel and from the hardware. Plus IIRC while doing this hardware clocks may skip clock tick interrupts. Plus the hardware clock is not corrected for drift. The system clock should be running an NTP daemon and would always have a corrected value. Because of these things it is almost always better to use the system clock over the hardware clock. Bob
signature.asc
Description: Digital signature