i do have two raspberry pi, One as publisher and another one as a subscriber. It works on the local area network without internet. Data transmission and receiving, works fine and data storing into MariaDB also works fine. The issue is time. The router run locally without internet connection. If someone switch off or restart router, the system depend on router time which not synchronise online time.
To over this issue, i did add in RTC DC3231 in both raspberry with the following setup.
# Reset the System Clock to UTC if the hardware clock from which it
# was copied by the kernel was in localtime.
#if [ -e /run/systemd/system ] ; then
# exit 0
if [ -e /run/udev/hwclock-set ]; then
if [ -f /etc/default/rcS ] ; then
# These defaults are user-overridable in /etc/default/hwclock
if [ -f /etc/default/hwclock ] ; then
if [ yes = "$BADYEAR" ] ; then
/sbin/hwclock --rtc=$dev --systz --badyear
/sbin/hwclock --rtc=$dev --hctosys --badyear
/sbin/hwclock --rtc=$dev --systz
/sbin/hwclock --rtc=$dev --hctosys
# Note 'touch' may not be available in initramfs
After i did this , its work on RTC time till someone reset or switch off the router. Upon router up, the raspberry pi picked up router time instead of RTC time. i have to do manually to switch to RTC time.
How i can over this, by saying just depend on RTC time only.