aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/init.d/sysfixtime
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/etc/init.d/sysfixtime')
-rwxr-xr-xpackage/base-files/files/etc/init.d/sysfixtime11
1 files changed, 11 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..4010e06
--- /dev/null
+++ b/package/base-files/files/etc/init.d/sysfixtime
@@ -0,0 +1,11 @@
+#!/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 -r {} +%s \; | sort -nr | head -n1)"
+ [ $curtime -lt $maxtime ] && date -s @$maxtime
+}
+