After reading Hawkins's blog, I mentioned how to correct the time to the local time in Fedora Core 6, and I also checked how ubuntu was set,
Suddenly realized the relationship between system programs, system startup scripts, and configuration files, a typical * nix style.
(1) shell script (system startup script) to be executed during system startup, such as/etc/init. d/hwclock. Sh
(2) This shell script imports a file in/etc as the configuration information, that is, the configuration file, for example,/etc/default/RCS.
(3) Whether the program is actually executed is a system program called in shell script, such as/sbin/hwclock.
The specific annotations are as follows:
Hwclocksh () { [! -X/sbin/hwclock] & Return 0 ./Etc/default/RCS <--- the variables in the configuration file are imported here.
./Lib/LSB/init-Functions
["$ GMT" = "-U"] & UTC = "yes" Case "$ UTC" in No | "") GMT = "-- localtime" <-- it is shown that if UTC is no, local time is enabled. UTC = "" ;; Yes) GMT = "-- UTC" UTC = "-- UTC" ;; *) Return 1 ;; Esac
###... The middle part is omitted ...###
If ["$ hwclockaccess "! = No]; then # Copies hardware clock time to system clock using the correct # Timezone for hardware clocks in local time, and sets Kernel # Timezone. Do not remove. /Sbin/hwclock -- hctosys $ GMT $ hwclockpars $ badyear <-- the real body of the running settings
|
Therefore, to enable the local time in Ubuntu, you must modify/etc/default/RCs as follows:
# Comment out the original setting: UTC = Yes
# Change to the following content...
UTC = No