2014-01-29 13:17:03 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2013-2014 OpenWrt.org
|
|
|
|
|
|
|
|
START=00
|
2016-02-08 08:25:53 +00:00
|
|
|
STOP=90
|
|
|
|
|
|
|
|
RTC_DEV=/dev/rtc0
|
|
|
|
HWCLOCK=/sbin/hwclock
|
2014-01-29 13:17:03 +00:00
|
|
|
|
|
|
|
boot() {
|
2016-02-08 08:25:53 +00:00
|
|
|
start && exit 0
|
|
|
|
|
2014-01-29 13:17:03 +00:00
|
|
|
local curtime="$(date +%s)"
|
2014-06-07 16:14:47 +00:00
|
|
|
local maxtime="$(find /etc -type f -exec date -r {} +%s \; | sort -nr | head -n1)"
|
2014-06-02 12:42:37 +00:00
|
|
|
[ $curtime -lt $maxtime ] && date -s @$maxtime
|
2014-01-29 13:17:03 +00:00
|
|
|
}
|
|
|
|
|
2016-02-08 08:25:53 +00:00
|
|
|
start() {
|
|
|
|
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -f $RTC_DEV
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -f $RTC_DEV && \
|
|
|
|
logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
|
|
|
|
}
|