+fake-hwclock (0.8) UNRELEASED; urgency=medium
+
+ * Add protection around save, don't go backwards unless forced.
+ Closes: #763589
+
+ -- Steve McIntyre <93sam@debian.org> Wed, 01 Oct 2014 12:34:30 +0100
+
fake-hwclock (0.7) unstable; urgency=medium
* Tweak the systemd bits again.
case $COMMAND in
save)
- date -u '+%Y-%m-%d %H:%M:%S' > $FILE
+ 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
-.TH FAKE-HWCLOCK 8 "5 April 2012" Debian
+.TH FAKE-HWCLOCK 8 "1 October 2014" Debian
.SH NAME
fake-hwclock \- Control fake hardware clock
.SH SYNOPSIS
.SS
.TP
\fBsave\fP
-Save the time to the file.
+Save the time to the file. If force is specified fake-hwclock will move the
+saved clock either backwards or forwards. Otherwise it will only move
+it forwards.
.TP
\fBload\fP
Load the time from the file. If force is specified fake-hwclock will move the