2 # hwclock.sh Set system clock to hardware clock, according to the UTC
3 # setting in /etc/default/rcS (see also rcS(5)).
5 # WARNING: If your hardware clock is not in UTC/GMT, this script
6 # must know the local time zone. This information is
7 # stored in /etc/localtime. This might be a problem if
8 # your /etc/localtime is a symlink to something in
9 # /usr/share/zoneinfo AND /usr isn't in the root
10 # partition! The workaround is to define TZ either
11 # in /etc/default/rcS, or in the proper place below.
13 [ ! -x /sbin/hwclock ] && exit 0
19 if [ "$VERBOSE" != no ]
21 echo "System time was `date`."
22 echo "Setting the System Clock using the Hardware Clock as reference..."
25 if [ "$HWCLOCKACCESS" != no ]
31 TZ="$TZ" hwclock --hctosys
35 if [ "$VERBOSE" != no ]
37 echo "System Clock set. System local time is now `date`."
40 stop|restart|reload|force-reload)
42 # Updates the Hardware Clock with the System Clock time.
43 # This will *override* any changes made to the Hardware Clock.
45 # WARNING: If you disable this, any changes to the system
46 # clock will not be carried across reboots.
48 if [ "$VERBOSE" != no ]
50 echo "Saving the System Clock time to the Hardware Clock..."
52 if [ "$HWCLOCKACCESS" != no ]
56 if [ "$VERBOSE" != no ]
58 echo "Hardware Clock updated to `date`."
63 if [ "$HWCLOCKACCESS" != no ]
69 echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
70 echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
71 echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2