ok...
I checked /etc/init.d/tc-config. (Near the end) and gave it a careful read > thanks Paul_123 for guiding me there
tc-config code snippet:
# After restore items
if [ -n "$NODHCP" ]; then
echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
else
[ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh &
[ -z "$NORTC" ] || /etc/init.d/settime.sh &
fi
This means that settime.sh will only be called IF nortc bootcode is set!
(mhh... to some point this is funny, that is actually the title of this thread :-) )
so... I included nortc bootcode...
test8, reboot from 2020 with nortc bootcode >> confirm settime.sh is executed; getTime.sh is not called
It becomes understandable:
- with nortc bootcode indeed settime.sh is called
- this takes 6 seconds to "wait for ifconfig >> which means that I "not really like to include this" in my boot sequence
- before calling getTime.sh it checks /bin/date -I, that returns a "2025" and resultantly getTime.sh is NOT called as was already identified in test3.
tc@hp510:~$ sudo date 010101012010
Fri Jan 1 01:01:00 CET 2010
tc@hp510:~$ date
Fri Jan 1 01:01:02 CET 2010. //so indeed set system to 2010, before the 2015 check
tc@hp510:~$ sudo reboot
.....wait....
tc@hp510:~$ date
Sat May 3 13:52:29 CEST 2025. //so time is updated to 2h03m wrong version
tc@hp510:~$ cd /tmp
tc@hp510:/tmp$ ls -l time.txt
-rw-r--r-- 1 root root 26 May 3 13:51 time.txt //yes, logging has been written now, so settime.sh has been called
tc@hp510:/tmp$ cat time.txt
end ifconfig check
6 //so ifconfig is detected after 6 loops of 1 second
2025 //so bin/date command gave 2025 year. and that means that getTime.sh is not called
What I think happens....
- setTime.sh sets the systemclock but NOT the HW clock.
- so on my one system I get 2h03m offset form HW clock at boot; on my other system I get 8min offset from HWclock.
text9, check HW clock >> indeed looks like hwclock is the bad guy
tc@huis:~$ sudo getTime.sh // make sure to have correct time
tc@huis:~$ date
Sat May 3 12:15:37 CEST 2025. // yes time is correct
tc@huis:~$ sudo hwclock --systohc //sync hwclock
tc@huis:~$ hwclock
Sat May 3 12:15:50 2025 0.000000 seconds. //hwclock is correct
tc@huis:~$sudo reboot
.... wait .....
tc@hp510:~$ date
Sat May 3 14:17:47 CEST 2025 //this seems 2h off
tc@hp510:~$ date
Sat May 3 14:18:12 CEST 2025
tc@hp510:~$ sudo getTime.sh
tc@hp510:~$ date
Sat May 3 12:18:20 CEST 2025. //so yes, it was 2hr off.. but... no longer 2hr03mins, I guess this is caused by timezone thing
tc@huis:~$sudo reboot. //try new reboot
.....wait....
tc@hp510:~$ hwclock
Sat May 3 12:22:12 2025 0.000000 seconds
tc@hp510:~$ date
Sat May 3 14:22:15 CEST 2025 // so yes, hwclock is correct, system time is not
So...
- unless nortc bootcode is set no time sync is done at all
- with nortc bootcode settime.sh is called but before calling getTime.sh the hardware clock is checked and unless it reports before 2015 getTime.sh is not called
- using "sudo hwclock --systohc" syncs the hw clock but does not properly take timezone into account >> I guess this is simply intended behaviour, just my ignorance on this.
For now I give it some rest.
things needs to sink in