aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpackage/base-files/files/etc/init.d/sysfixtime13
1 files changed, 13 insertions, 0 deletions
diff --git a/package/base-files/files/etc/init.d/sysfixtime b/package/base-files/files/etc/init.d/sysfixtime
new file mode 100755
index 0000000000..525d765758
--- /dev/null
+++ b/package/base-files/files/etc/init.d/sysfixtime
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2013-2014 OpenWrt.org
+
+START=00
+
+boot() {
+ local curtime="$(date +%s)"
+ local maxtime="$(find /etc -type f -exec date +%s -r {} \; | sort -nr | head -n1)"
+ [ $curtime -lt $maxtime ] && \
+ date -s @$maxtime && \
+ logger -t sysfixtime -p daemon.notice "Time fixed"
+}
+