LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   NTP and Timezon (https://www.linuxquestions.org/questions/linux-general-1/ntp-and-timezon-105182/)

zozoonabike 10-17-2003 12:10 PM

NTP and Timezon
 
Hello,

I tried to set up a NTP server on my server and to use it from my laptop (which is client on the network). But it didn't work...
So I wanted to set back my clock with no NTP server with the redhat-config-date command. I did it, telling that my timezone was Pacific Time (Americana/Tijuana) and I validate. But since then I am always in UTC time and there is no way for me to go back to the Pacific Time... What's going on ?
I even checked the /etc/sysconfig/clock file and it seems to be correct...
What can I do ?

Thanks,

Olivier

clacour 10-22-2003 07:10 AM

Try redhat-config-date again, click on timezone and look down at the bottom left. There's a checkbox that says your system is/is not on UTC time.

From the description of your problem, whichever one it is (on or off), flip it to the other one. (You might have to reset your time after you do that.)

Linux will keep time in the hardware clock either in UTC (aka Greenwich, aka Zulu) time, or local time (your timezone).

If the software thinks it's in local time, it won't apply a timezone correction (7 hours, I believe, in your case), because the hardware clock already has that factored in. If, in fact, your hardware clock is in UTC time, everything's going to be 7 hours off.

It's basically a mismatch between the stuff that says which flavor time to store in the hardware clock, and the stuff that tries to display it.

You can use the "hwclock" command to see what time the hardware clock is set to.

The config file that tells it which version to use is /etc/sysconfig/clock.

Hope this helps,

CHL

zozoonabike 10-22-2003 01:59 PM

Hello Clacour...

Thanks for the advice.
I tried the hwclock and I saw that my system clock was UTC.
So I ran once again redhat-config-date and tried with to change the check box (actually I checked it since it was unchecked) but it doesn't change anything. When in a terminal I do a "date" I still have my clock in UTC time.
But when I do an su (or log root) the "date" command respond with a PCT...
I noticed something weird : when I tried to check the services launched to check if the ntpd is running (I launch redhat-config-services) and I go on this particular service (ntp) then my CPU start working like crazy and I have to stop the service application... There is really something weird with this ntp stuff...

Olivier

clacour 10-22-2003 08:22 PM

As I mentioned, you might need to reset the time after you've flipped that bit. Also, this is one of the few cases where it might be a good idea to reboot the machine. I'm not sure where in the boot process the system forms its ideas of how time works, so I can't tell you specifically what to do to make sure it has everything in sync. If this is a dual-boot Linux/Windows system, definitely use local time and do NOT use UTC. Windows doesn't understand UTC at all.

I can probably help with the NTP stuff, if you like. It's actually pretty straightforward, once you know how it works.

For starters, try the command "ntpdate pool.ntp.org". (Make sure ntpd is not running first. Ntpd and ntpdate won't share.) That should set your system to the current time, according to the UTC and timezone settings. (Do this after the reboot I mentioned. Changing the file in /etc/sysconfig/clock doesn't do anything directly.) That should set your time to the world standard.

If you want to do ntp from both the server you mentioned and the laptop, post the /etc/ntp.conf files for both systems. Basically, anything that's running ntpd can be an ntp server. The only gotcha is that it needs to succeed in connecting to the ntp network itself.

zozoonabike 10-23-2003 04:40 PM

How do I put the hardware clock in local time and not in UTC ?
I tried the command hwclock --localtime --set XXXXXX and my hardware clock is still in UTC...
Thanks,
Olivier

clacour 10-24-2003 08:29 PM

Use redhat-config-date to set the time, and to uncheck the "UTC" box.

Double-check that /etc/sysconfig/clock says "local" or something like that (anything but "UTC", basically).

Say "hwclock --systohc"

Reboot the system to make sure all the pieces have the same idea. (If you/I knew the clock system better, this step wouldn't be necessary, but if the correct time survives a reboot, you can be pretty sure it's right now.)

You can also use the "date" command to set the clock:

"date 10242027" would set the system time to Oct 24, 2003, 20:27 (aka 8:37PM).

redhat-config-date should use the "date" command internally, but if for whatever reason, it's wrong when you get out of the window, you can use the command-line command "date" instead.

Use the "hwclock --systohc" after you have the time right. (Check it by saying "date" with no options.)

zozoonabike 10-24-2003 09:30 PM

It's crazy !!!
So I have done exactly what you said. And the result is :
When I am root, everything is cool, I am with the right time and right timezone.
But when I am not root (regular user) I am still in UTC. If I do the date command (or the redhat-config-date) I have to be root and the date is set propely. I event try to reset it but it doesn't change anything when back to regular user.
For the sysclock, I did the hwclock --systohc command, then a hwclock to check everything is fine... Everything was find. I did reboot and back from the reboot, my hwclock was back to UTC...
So my hwclock is UTC and my user clock is also UTC but not at the same hour : that's terrific !
I even tried to have a look at the BIOS time and it was fine... (I couldn't check the timezone since you have no opportunity to change that)...
Well if you have any other idea, but don't worry if you don't I will by a big clock to put on my desk :-(


All times are GMT -5. The time now is 06:32 AM.