1752782 Members
6292 Online
108789 Solutions
New Discussion юеВ

Re: Time and Timezone

 
SOLVED
Go to solution
rustam_2
Super Advisor

Time and Timezone

Hi all,
I dont know why but time of my servers change to current_time - 1 hour. I guess it's coz of time zone. Our country doesnt change time to winter and summer time zone and it must be GMT + 5.00. Now command date shows me
$ date
Mon Nov 8 09:58:44 WST 2010
and in file /etc/TIMEZONE is value
# less TIMEZONE
TZ=WST-5WSTDST
export TZ

Time must be 10:58:44.

So how can change time and timezone correctly without rebooting? which way is better command date or set_parms?

Can i use windows NTP server to my HP-UX version 11.3?

thanks and regards,
Rustam
9 REPLIES 9
Michal Kapalka (mikap)
Honored Contributor

Re: Time and Timezone

hi,

i would recommend you to change the time with the reboot of the system.

yes you can run NTP server on the WIndows OS, its doesn't matter on the OS ( unix / linux / Windows ... )

mikap
Shibin_2
Honored Contributor

Re: Time and Timezone

Are you using NTP services? If so, check your NTP, whether it is in sync or not.

#ntpq -p
Regards
Shibin
rustam_2
Super Advisor

Re: Time and Timezone

Hi mikap and Shibin,

Mikap, so u suggest to use set_parms time? How about TIMEZONE?
My NTP Server is running on Windows Server 2003 where is domain structure exist. Is it ok for HP-UX?
Shibin, this command #ntpq ├в p shows me this:
# ntpq -p
ntpq: read: Can't assign requested address

Michal Kapalka (mikap)
Honored Contributor

Re: Time and Timezone

hi,

edit /etc/default/tz

sms:/etc/default#strings tz
MET-1METDST

for example my time zone definition.

==> check the NTP config

strings /etc/ntp.conf

server IP_OF_YOUR_NTP_server(1-x)

grep -i xntp /etc/rc.config.d/netdaemons

# xntp configuration. See xntpd(1m) #
# XNTPD: Set to 1 to start xntpd (0 to not run xntpd)
# XNTPD_ARGS: command line arguments for xntpd
export XNTPD=1
export XNTPD_ARGS=

mikap
Matti_Kurkela
Honored Contributor
Solution

Re: Time and Timezone

If your country doesn't use Daylight Saving Time (= summer/winter time), then your TZ variable should be set to WST-5, not WST-5WSTDST.

It's recommended to reboot the system after changing /etc/TIMEZONE, but if you cannot do that, you should at least restart all daemons and other long-running processes that are using time information.

Since the WST-5WSTDST timezone is now on winter time, changing the TZ to remove the DST identifier will have no visible effect now. If a reboot can be scheduled at some time between now and the last week of March 2011, you'll probably be fine.

The next step is to set your clock to correct time. It is now 1 hour slow, so you must change the clock forward. This is fortunate, because turning the clock backwards is generally not safe when applications are running.

To make such a major change to the system clock, ntpd is not ideal. You might want to use either "date" or "ntpdate" commands to set the system clock.

If you want to test the accessibility of your NTP server, run "ntpdate -d ". It will display some diagnostic messages, and indicate how much it *would* change the clock if it were run for real. But when using option "-d", it won't actually change anything.

If your Windows NTP server seems to work and has a connection to reliable timesources, you can use it.

# ntpq -p
ntpq: read: Can't assign requested address

This only means xntpd is not running on your system. (Note: when xntpd is running, you cannot use ntpdate - they both would be trying to use the same UDP port, creating a conflict. But when xntpd is properly configured and running, you usually won't need ntpdate.)

MK
MK
Shibin_2
Honored Contributor

Re: Time and Timezone

Matti has explained it well.

Were you using NTP services in UNIX ?
Regards
Shibin
rustam_2
Super Advisor

Re: Time and Timezone

Mikap,
In this file /etc/ntp.conf I couldn├в t find string
server IP_OF_YOUR_NTP_server(1-x)
Should I add new string?
Server IP_OF_MY_NTP_SERVER(1-x)
grep -i xntp /etc/rc.config.d/netdaemons shows me
# xntp configuration. See xntpd(1m) #
# XNTPD: Set to 1 to start xntpd (0 to not run xntpd)
# XNTPD_ARGS: command line arguments for xntpd
export XNTPD=0
export XNTPD_ARGS=

MK,
I changed time with set_parm date_time command
Should I just open /etc/TIMEZONE file and edit valueTZ=WST-5WSTDST export TZ to TZ=WST-5 export TZ with any editor?
>> This only means xntpd is not running on your system. (Note: when xntpd is running, you cannot use ntpdate - they both would be trying to use the same UDP port, creating a conflict. But when xntpd is properly configured and running, you usually won't need ntpdate.)

So I have to check and configure xntpd correctly, right?
Dennis Handly
Acclaimed Contributor

Re: Time and Timezone

>but time of my servers change to current_time - 1 hour. I guess it's because of time zone.

Yes, that's when it changes in the US.

>Our country doesn't change time to winter and summer time zone and it must be GMT + 5.

As MK said, then you must use a timezone like: WST-5
(Otherwise you follow the US rules.)

>MK: The next step is to set your clock to correct time. It is now 1 hour slow, so you must change the clock forward.

How do we know it is slow? What does "date -u" show? Because it was correct during the summer?
Matti_Kurkela
Honored Contributor

Re: Time and Timezone

> So I have to check and configure xntpd correctly, right?

Yes, that would be a good thing to do. But xntpd is good in making small corrections (up to a few minutes), but you're likely to need a correction of +1 whole hour. It's faster to make a big correction using date/ntpdate, then configure and start up xntpd to keep it in sync with high precision.


Dennis> How do we know it is slow? What does "date -u" show? Because it was correct during the summer?

The original post includes the current TZ setting, and the fact that the local time is now exactly 1h slow. By looking at the HP-UX tztab definition for WST-5WSTDST (a timezone with its own specific DST definition in HP-UX tztab) I can see the latest DST transition for it has happened on the last Sunday of October. By doing a "reverse transform", it is possible to figure out what the UTC time must be.

It is conceivable that this has been noticed only after a week has passed, since the poster says they don't use DST in their country... and so are unlikely to pay any special attention to system clocks at DST transition times.

Of course, it's possible that rustam might have custom TZ settings for his account only, but I find it unlikely since most people seem to be totally unaware of this feature of Unix systems.

MK
MK