OpenWrt Forum Archive

Topic: sysntpd only sets on reboot

The content of this topic has been archived on 18 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I need to be able to change the system timezone setting and restart the built-in ntpd daemon.  Any ideas what I am missing:

root@OpenWrt:~# uci show system.@system[0].timezone
system.cfg02e48a.timezone=MST7
root@OpenWrt:~# date
Mon Jul 23 13:22:38 MST 2012
root@OpenWrt:~# uci set system.@system[0].timezone=MST-7
root@OpenWrt:~# uci commit
root@OpenWrt:~# /etc/init.d/sysntpd restart
root@OpenWrt:~# date
Mon Jul 23 13:23:13 MST 2012

??

This is using the vanilla out of the box firmware's sysntpd.  I did notice that if I change it, and reboot, it seems to set it correctly.  What am I missing?  How can I get around the requirement of rebooting?

Thanks!

Bump - any ideas?

All you need to do to apply the new timezone is:

uci get system.@system[0].timezone > /tmp/TZ

The init scripts do basically that on boot. You do not even need to restart the ntpd since the timezone just controls the date formatting / localtime calculation, the internal system time is always in UTC.

Hmm ... we have a process that is running and logging the time and we use those times in our reporting.  So the date is pretty important.

We are currently using rdate, but I noticed that is deprecated for using ntpd instead.  Am I missing something?  Is the internal date driven off the /tmp/TZ and that is why when I hit date it wasn't working?

Thanks!

I don't understand your question.

NM - your solution worked perfectly.  I was just trying to understand, but in the end I don't prob need to know - it just works!  Thanks!

The discussion might have continued from here.