I am trying to synch the hour between localtime and RTC. I have DS3231 RTC, i followed a guide to install and configure the OS to use it, RTC is working, but the time without internet is 2 hours backwards. My timezone is GMT+2 and its set correctly in /etc/localtime. When NTP is working everything is looking fine. Output of timedatectl:
Local time: Mon 2019-11-18 11:42:28 EET
Universal time: Mon 2019-11-18 09:42:28 UTC
RTC time: Mon 2019-11-18 09:42:29
Time zone: Etc/UTC (EET, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
When i unplug the ethernet cable and restart raspberry, the local time is moving automaticly from 11:42 to 9:42
How to fix this problem? Thank you.
PS: I tried with this shell script manually to enter the hour of RTC:
newhour=$(date +%T --date '2 hours');
curdate=$(date '+%d %b %Y')
settime="$curdate $newhour"
echo $settime
sudo hwclock --set --date "$settime"
But NTP is fixing the value stored in RTC...