/sbin/fake-hwclock is in fake-hwclock 0.9.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/bin/sh
#
# Trivial script to load/save current contents of the kernel clock
# from/to a file. Helpful as a *bootstrap* clock on machines where
# there isn't a useful RTC driver (e.g. on development boards). Using
# NTP is still recommended on these machines to get to real time sync
# once more of the system is up and running.
#
# Copyright 2012 Steve McIntyre <93sam@debian.org>
#
# License: GPLv2, see COPYING
if [ "$FILE"x = ""x ] ; then
    FILE=/etc/fake-hwclock.data
fi
COMMAND=$1
if [ "$COMMAND"x = ""x ] ; then
    COMMAND="save"
fi
FORCE=false
if [ "$2"x = "force"x ] ; then
    FORCE=true
fi
case $COMMAND in
    save)
        if [ -e $FILE ] ; then
            SAVED="$(cat $FILE)"
            SAVED_SEC=$(date -u -d "$SAVED" '+%s')
            NOW_SEC=$(date -u '+%s')
            if $FORCE || [ $NOW_SEC -ge $SAVED_SEC ] ; then
                date -u '+%Y-%m-%d %H:%M:%S' > $FILE
            else
                echo "Current system time: $(date -u '+%Y-%m-%d %H:%M:%S')"
                echo "fake-hwclock saved clock information is in the future: $SAVED"
                echo "To force the saved system clock backwards anyway, use \"force\""
            fi
        else
            date -u '+%Y-%m-%d %H:%M:%S' > $FILE
        fi
        ;;
    load)
        if [ -e $FILE ] ; then
            SAVED="$(cat $FILE)"
            SAVED_SEC=$(date -u -d "$SAVED" '+%s')
            NOW_SEC=$(date -u '+%s')
            if $FORCE || [ $NOW_SEC -le $SAVED_SEC ] ; then
                date -u -s "$SAVED"
            else
                echo "Current system time: $(date -u '+%Y-%m-%d %H:%M:%S')"
                echo "fake-hwclock saved clock information is in the past: $SAVED"
                echo "To set system time to this saved clock anyway, use \"force\""
            fi      
        else
            echo "Unable to read saved clock information: $FILE does not exist"
        fi
        ;;
    *)
        echo $0: Unknown command $COMMAND
        exit 1
        ;;
esac
 |