summaryrefslogtreecommitdiff
path: root/package/base-files/files/etc/init.d/sysfixtime
blob: 525d765758d06c3e1cb75e9866a008781bc2f467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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"
}