Page 1 of 1

(Solved) Setting system time from hardware clock

Posted: 14. Mar 2012, 13:46
by loukingjr
I have Salix 13.37 XFCE installed as a guest in VirtualBox. Everything works fine but, when I start the guest it takes what seems to be a long time to "set the time from hardware clock(localtime), (10-20secs). It also happens when it tries to save the system time on shutdown. Any thoughts on this?

thanks ahead of time.

Re: Setting system time from hardware clock(localtime)

Posted: 18. Mar 2012, 22:26
by gapan
Most probably an issue with virtualbox itself. What version are you running? See if you there is an option inside the virtualbox settings about setting the clock to utc or not.

Re: Setting system time from hardware clock(localtime)

Posted: 18. Mar 2012, 22:54
by loukingjr
gapan wrote:Most probably an issue with virtualbox itself. What version are you running? See if you there is an option inside the virtualbox settings about setting the clock to utc or not.
actually VB defaults to UTC. I may have set Salix to local when I installed it. Is there a way to change it in Salix itself?

Re: Setting system time from hardware clock(localtime)

Posted: 18. Mar 2012, 23:00
by gapan
System menu/System clock.

Re: Setting system time from hardware clock(localtime)

Posted: 18. Mar 2012, 23:27
by loukingjr
thanks much. It wasn't set to UTC and now that it is it's much better.

Re: (Solved) Setting system time from hardware clock

Posted: 22. Jan 2016, 07:24
by rsal
I know this is an old thread. I had similar problem so before posting I searched and found this. I could correct my problem with this post. But I want to know what is the command line equivalent of this (checking out UTC option in System menu > system clock) ? In other distributions I can change from UTC to LOCAL in /etc/adjtime. But in Salix, it reverts back to UTC on rebooting.

Re: (Solved) Setting system time from hardware clock

Posted: 22. Jan 2016, 07:25
by gapan

Code: Select all

sudo clocksetup
and if you mean what the actual code that sets the timezone is, this is it:

Code: Select all

	cd /etc
	if [[ "$zone" && -r /usr/share/zoneinfo/$zone ]]; then
		ln -sf /usr/share/zoneinfo/$zone localtime-copied-from
		rm -f localtime
		cp localtime-copied-from localtime
	fi

Re: (Solved) Setting system time from hardware clock

Posted: 22. Jan 2016, 07:32
by rsal
That is a good utility (also there in Slackware installation if I remember correctly). But why not simplify and just have settings in /etc/adjtime picked up at boot time? Well, every distribution is different and Salix is one of the best distributions.

Re: (Solved) Setting system time from hardware clock

Posted: 22. Jan 2016, 12:25
by rsal
What is the actual command that makes the system know that hardware clock is in UTC (or local) time.

Re: (Solved) Setting system time from hardware clock

Posted: 22. Jan 2016, 23:25
by gapan
rsal wrote:That is a good utility
Thank you!
rsal wrote:also there in Slackware installation if I remember correctly
No. That would be timeconfig.
rsal wrote:But why not simplify and just have settings in /etc/adjtime picked up at boot time?
That file is not to be edited by hand. hwclock can update it and read from it.
rsal wrote:What is the actual command that makes the system know that hardware clock is in UTC (or local) time.
You can edit your /etc/hardwareclock and use hwclock to apply any changes if you want to do everything manually, but I don't see a reason to do that.

Code: Select all

man hwclock
for more details.