3 # init system time from RTC value
6 # To adjust for the drift of the RTC, you have to issue the command
7 # hwclock --set --date=<exacttime>
8 # manually 2 times with a considerable time (several days) in between.
9 # The more drift you let accumulate the better hwclock can compute the
12 #locate and source functions script
13 source `PATH=$INIT_D/:/sbin/init.d:/etc/init.d:/etc/rc.d type -p functions`
15 #in sysconfig, env. variable UTC is set to yes/true/1 if RTC set to GMT
16 source $sysconfig_clock
20 #need to write /etc/adjtime
21 #I guess setting clock will work even if /etc/adjtime can't be written,
22 #so don't exit_if_any_error
23 need
$mounted_filesystems
25 echo 'Adjusting RTC and setting system time...'
26 CLOCKPARAMS
="--hctosys"
29 CLOCKPARAMS
="$CLOCKPARAMS --utc"
32 CLOCKPARAMS
="$CLOCKPARAMS --localtime"
35 hwclock --adjust && hwclock $CLOCKPARAMS
36 up_evaluate_retval || exit_if_any_error