openwrt在哪里存储时间?它是如何存储时间的?
where does openwrt store time ? How does it store the time?
我的设备有 openwrt。假设设备中的时间是 3:00pm,然后我断开电源。如果我在 3:15pm 时再次接通电源,它还有 3:00pm 时间。我知道它没有 RTC 来更新时间,但是它将时间存储为 3:00 pm?文件位置是什么?
系统日期和时间由 /etc/init.d/sysfixtime
脚本通过查找在 /etc
中找到的任何文件的最新时间戳来设置:
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
}
然后,如果您有 Internet 连接,NTP 客户端将从 /etc/config/system
中配置的 NTP 服务器接收实际日期和时间
我的设备有 openwrt。假设设备中的时间是 3:00pm,然后我断开电源。如果我在 3:15pm 时再次接通电源,它还有 3:00pm 时间。我知道它没有 RTC 来更新时间,但是它将时间存储为 3:00 pm?文件位置是什么?
系统日期和时间由 /etc/init.d/sysfixtime
脚本通过查找在 /etc
中找到的任何文件的最新时间戳来设置:
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
}
然后,如果您有 Internet 连接,NTP 客户端将从 /etc/config/system