diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-01-30 15:49:17 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-01-30 16:02:48 +0000 |
commit | 93c5a3d003e6bfa59019b8b3ef58b9d07bb835b6 (patch) | |
tree | 54090ea09693a3ac071d6c8a1a4877d8bf61b778 | |
parent | d2151e2f9a6e247aae7f7fd0cb04da8be16cadff (diff) | |
download | lorry-controller-93c5a3d003e6bfa59019b8b3ef58b9d07bb835b6.tar.gz |
Fix IMPLEMENTS bug for when timestamps are whole-sec
-rw-r--r-- | yarns.webapp/900-implementations.yarn | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/yarns.webapp/900-implementations.yarn b/yarns.webapp/900-implementations.yarn index 4a0c22b..d311362 100644 --- a/yarns.webapp/900-implementations.yarn +++ b/yarns.webapp/900-implementations.yarn @@ -137,4 +137,11 @@ request" step updating the modification time of a file for this purpose. IMPLEMENTS THEN static status page got updated - test "$DATADIR/lc-status.html" -nt "$DATADIR/request.timestamp" + # test -nt isn't useful: the timestamps might be identical, and + # that's OK on filesystems that only store full-second timestamps. + # We generate timestamps in (roughly) ISO 8601 format, with stat, + # and those can be compared using simple string comparison. + + status=$(stat -c %y "$DATADIR/lc-status.html") + request=$(stat -c %y "$DATADIR/request.timestamp") + test "$request" = "$status" || test "$request" '<' "$status" |