summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files')
-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 0000000..525d765
--- /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"
+}
+