I have device which has openwrt. Lets say time in device is 3:00pm and then I remove power. If I attach power again at 3:15pm it still has 3:00pm time. I know it doesnt have RTC to update time but where it stores time as 3:00 pm ? What is the file location ?
System date and time are set by /etc/init.d/sysfixtime
script by finding the most recent timestamp of any file found in /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
}
Then, if you have Internet connection, NTP client will receive the actual date and time from an NTP server configured in /etc/config/system