@@ -2,10 +2,27 @@
# Copyright (C) 2013-2014 OpenWrt.org
START=00
+STOP=90
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
+ if [ ! -e /dev/rtc ]; then
+ local curtime="$(date +%s)"
+ local maxtime="$(find /etc -type f -exec date -r {} +%s \; | sort -nr | head -n1)"
+ [ $curtime -lt $maxtime ] && date -s @$maxtime
+ else
+ hwclock -s
+ fi
+}
+
+start() {
+ if [ -e /dev/rtc ]; then
+ hwclock -s
+ fi
+}
+
+stop() {
+ if [ -e /dev/rtc ]; then
+ hwclock -w
+ fi
}
From: Daniel Dickinson <openwrt@daniel.thecshore.com> On systems that have an RTC prefer it to the file-based time fixup (i.e. use hwclock when there is a permanent clock instead of the faked up time logic that is needed when there is not RTC). --- package/base-files/files/etc/init.d/sysfixtime | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)