1825805 Members
2107 Online
109687 Solutions
New Discussion

Re: changing system time

 
Lisa Dingman
Regular Advisor

changing system time

After installing new disk drives and rebooting from tape the system time seems to be 2 hours off. Is there any possible problems associated with changing the system time as in these messages. Am new to sys admin, Thank you.
14 REPLIES 14
Ron Irving
Trusted Contributor

Re: changing system time

Hiya Lisa, and welcome!!

At the root prompt, type:
# set_parms date

follow the bouncing prompt. Once you get it all set, look into NTP, and sync with an outside source, or another server in your organization.

Hope this helps!!
Should have been an astronaut.
James R. Ferguson
Acclaimed Contributor

Re: changing system time

Hi Lisa:

Verify the true time with:

# date -u

This returns the UTC (GMT) time. Your localtime is governed by your TZ (timezone) setting. The master setting should reside in '/etc/TIMEZONE'. Individual login profiles may differ.

You should be synchronizing to an external time source with NTP to maintain a correct time.

You can reset your date by using 'date':

# date [-u] [mmddhhmm[[cc]yy]]

If you are stepping the date/time forward this is "safe". If you are adjusting backwards, you should first stop all time-sensitive processes (notably databases); adjust the time; and then restart the processes. The 'cron' daemon should also be stopped and restared if you are moving time backwards.

Regards!

...JRF...
Lisa Dingman
Regular Advisor

Re: changing system time

Thanks everyone so much, is a big help!
Lisa Dingman
Regular Advisor

Re: changing system time

Could you tell me please what is NTP? Also this is the output form the following date and date -u commands. Why is there a discrepency between the two?
# date
Tue Mar 25 17:07:21 CDT 2008
# date -u
Tue Mar 25 22:07:24 UTC 2008
#
Patrick Wallek
Honored Contributor

Re: changing system time

There is a discrepancy because the 'date' command (without the '-u') is displaying the time in YOUR time zone, currently CDT.

The 'date -u' command is display the time in UTC/GMT (Universal Time Coordinate / Greenwich Mean Time).
James R. Ferguson
Acclaimed Contributor

Re: changing system time

Hi (again) Lisa:

> Could you tell me please what is NTP?

NTP = Network Time Protocol

http://docs.hp.com/en/B2355-90774/ch04.html

...no server should be without it (IMHO)!

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: changing system time

HP-UX keeps only one time and that is UTC (also known as GMT or Zulu time) which is the time that the entire world uses as a reference. To accommodate humans, the world is divided into timezones, but they aren't very accurate and keep bouncing around due to political decisions.

The good news is that HP-UX can provide every timezone at the same time using a variable called TZ. Your TZ value can be seen with the command:

echo $TZ

It was set when you logged in from the value stored in /etc/TIMEZONE. This file is changed when you first install your system and pick the local timezone. This TZ value is used in conjunction with /usr/lib/tztab where the rules for dozens of different timezones (not all) are located.

So if the date command (without -u) is off by hours, don't change the time until you look at the timezone, in your case CDT which means Central Daylight Saving Timezone. If this timezone is correct for your local system, then (as root) you can change the time to match your local time. NOTE: don't change time when applications are running. To be safe, reboot into single user mode and change the time there.

Now if any users login from remote sites where they have a different timezone, they can change the TZ value in their .profile to match their local time. It will not affect the system time as the TZ value is only translating the time (from UTC) based on the rules in tztab.

NTP is the most popular (and precise) tool to keep all your servers in sync. Computer clocks will drift over time and NTP will keep your system in sync with the atomic clocks all over the Internet. Setting up NTP is easy, but finding several NTP servers depends very much on your local data center. If you have network administrators, ask them about NTP servers that already exists in your company.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: changing system time

>Also this is the output form the following date and date -u commands. Why is there a discrepancy between the two?
# date
Tue Mar 25 17:07:21 CDT 2008
# date -u
Tue Mar 25 22:07:24 UTC 2008

There is no discrepancy. You have the correct times for UTC and CDT.
I.e. a time is composed of a date, time of day and a zone.
17:07:21 CDT
22:07:24 UTC

If you are off by 2 hours, you aren't in the CDT timezone. You are either off the coast of New Jersey :-) or in PDT.
So instead of using TZ=CST6CDT, you need to use TZ=PST8PDT.

>Bill: So if the date command (without -u) is off by hours, don't change the time until you look at the timezone

From the timestamp on Lisa's reply, it seems the timezone is wrong. Unless she took longer than 6 minutes to reply or the ITRC forums were down. :-)
Dennis Handly
Acclaimed Contributor

Re: changing system time

>ME: From the timestamp on Lisa's reply, it seems the timezone is wrong. ...

Oops, looking more closely, it looks like UTC is two hours too fast. So you'll need to pay attention to JRF's caution about going back in time.
HPquestion
Regular Advisor

Re: changing system time

$ date
Wed Apr 23 13:30:35 EDT 2008
$ date -u
Wed Apr 23 17:30:38 UTC 2008

Actual time is 2:07PM EST.

How can I set the system clock in HP-UX 11i version2?
If I do
date [-u] [mmddhhmm[[cc]yy]]
,do I have to specify the time in UTC?

How to set the system time to Wed Apr 23 14:07:35 EDT 2008 from Wed Apr 23 17:30:38 UTC 2008 ??
Steven E. Protter
Exalted Contributor

Re: changing system time

Shalom,

The obvious answer is to take the following steps:

1) Configure the system to use a valid NTP time source. This can be done with sam or on the command line.
2)Use set_parms to push the date forward but never backward. Rolling system time backward will cause Oracle databases to crash and possibly corrupt.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: changing system time

>$ date
Wed Apr 23 13:30:35 EDT 2008
>$ date -u
Wed Apr 23 17:30:38 UTC 2008
>Actual time is 2:07PM EDT.

>How can I set the system clock in HP-UX?
>If I do
date [-u] [mmddhhmm[[cc]yy]]
>do I have to specify the time in UTC?

No, if TZ it set correct to EDT, you just use the local time.

>How to set the system time to Wed Apr 23 14:07:35 EDT 2008 from Wed Apr 23 17:30:38 UTC 2008?

This moves forward about 37 minutes, if you did it then:
# date 04231407
Lisa Dingman
Regular Advisor

Re: changing system time

Thank you everyone for all your help!
Sajjad Sahir
Honored Contributor

Re: changing system time

Dear Lisa

date is the command for that

see man date

thanks and regards

sajjad