3 # Trivial script to load/save current contents of the kernel clock
4 # from/to a file. Helpful as a *bootstrap* clock on machines where
5 # there isn't a useful RTC driver (e.g. on development boards). Using
6 # NTP is still recommended on these machines to get to real time sync
7 # once more of the system is up and running.
9 # Copyright 2012 Steve McIntyre <93sam@debian.org>
11 # License: GPLv2, see COPYING
13 if [ "$FILE"x = ""x ] ; then
14 FILE=/etc/fake-hwclock.data
18 if [ "$COMMAND"x = ""x ] ; then
24 date -u '+%Y-%m-%d %H:%M:%S' > $FILE;;
26 if [ -e $FILE ] ; then
27 date -u -s "`cat $FILE`"
29 echo "Unable to read saved clock information: $FILE does not exist"
32 echo $0: Unknown command $COMMAND