Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
45 lines
764 B
Bash
Executable File
45 lines
764 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2013-2014 OpenWrt.org
|
|
|
|
START=00
|
|
STOP=90
|
|
|
|
RTC_DEV=/dev/rtc0
|
|
HWCLOCK=/sbin/hwclock
|
|
|
|
boot() {
|
|
hwclock_load
|
|
local maxtime="$(find_max_time)"
|
|
local curtime="$(date +%s)"
|
|
if [ $curtime -lt $maxtime ]; then
|
|
date -s @$maxtime
|
|
hwclock_save
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
hwclock_load
|
|
}
|
|
|
|
stop() {
|
|
hwclock_save
|
|
}
|
|
|
|
hwclock_load() {
|
|
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV
|
|
}
|
|
|
|
hwclock_save(){
|
|
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \
|
|
logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
|
|
}
|
|
|
|
find_max_time() {
|
|
local file newest
|
|
|
|
for file in $( find /etc -type f ) ; do
|
|
[ -z "$newest" -o "$newest" -ot "$file" ] && newest=$file
|
|
done
|
|
[ "$newest" ] && date -r "$newest" +%s
|
|
}
|