1832576 Members
4061 Online
110043 Solutions
New Discussion

HP-UX and Time settings

 
andy_197
Occasional Contributor

HP-UX and Time settings

During the installation process of HP-UX, does the time automatically set itself to the UTC time format??


I heard that UNIX systems are set to UTC by default but I just want to confirm that.
8 REPLIES 8
Sundar_7
Honored Contributor

Re: HP-UX and Time settings

Andy,

It is not the HP-UX that keeps the time for you. It is the clock in the motherboard of your system that stores the time.

This topic has been discussed number of times.

All your system hardware clock does is to keep counting from Jan'1 1970. When you issue commands like date, for example, refers to the TZ environment variable and convert UTC to the corresponding local time using the /usr/lib/tztab table.

- Sundar
Learn What to do ,How to do and more importantly When to do ?
A. Clay Stephenson
Acclaimed Contributor

Re: HP-UX and Time settings

When HP-UX is installed, you are prompted for the default timezone; this value is then stored in /etc/TIMEZONE. This file is used to set the default value for TZ. If TZ is not set then the kernel tunable 'timezone' comes into play. Bear in mind, a system might have several valid TZ settings at any one time --- users might be scattered across many timezones.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: HP-UX and Time settings

EVERY HP-UX system keeps time in UTC format. It is not a default, it is the way it operates. When you login. the 'translator' variable TZ is set by /etc/TIMEZONE as part of your login profile, so you see UTC translated by the TZ value. Read the contents of /usr/lib/tztab and the man page for tztab. You can create your own private timezone if you want. HP-UX is somewhat unique in being able to provide *every* timezone at the same time, and also handle any crazy rule about Daylight Saving time. But internally, HP-UX always keep UTC and never changes for Daylight Saving.


Bill Hassell, sysadmin
andy_197
Occasional Contributor

Re: HP-UX and Time settings

So, just to confirm, does HP-UX manage time in UTC??

Because I heard that ALL UNIXs operates the "default" time format in UTC. But, my question is, if an HP-UX administrator DOES NOT select the Local Timezone (TZ) does that mean that it will automatically set the time in UTC by default?

Thanks
Sridhar Bhaskarla
Honored Contributor

Re: HP-UX and Time settings

Hi Andy,

The timezone variable "TZ" has nothing to do with how HP-UX keeps it's time. "TZ" variable is only for the interpretation of time. The default "TZ" is listed in /etc/TIMEZONE file. By default everyuser's TZ variable gets it. Generally to make more sense, SAs configure the TIMEZONE to where the systems are located. Some SAs tend to configure GMT if their systems in different locations to get a relative picture.

Default TZ can be overwritten by specifying the user's own Timezone in his/her .profile. For ex., as a user I can do

$export TZ=GMT
$date
$export TZ=CST6CDT
$date

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: HP-UX and Time settings

Answer to your question.

Yes. It does keep time in UTC format. Its Unix.

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
Bill Hassell
Honored Contributor

Re: HP-UX and Time settings

When HP-UX is installed, you are asked about your location in order to set the TZ value. If your computer came preinstalled, then a default value for TZ was set (probably US-Mountain or US-Pacific). To set your default timezone, just run the program set_parms as root:

/sbin/set_parms timezone

That will set /etc/TIMEZONE and now each user that logs in will have the TZ value set for this location. As mentioned, TZ controls how time is displayed or provided to user programs. So someone from a different country can login to your system, export TZ in their current session and see their local time including timestamps on files (ls -l) as well as applicatins that are run from that session.


Bill Hassell, sysadmin
Rick Garland
Honored Contributor

Re: HP-UX and Time settings

You're right - all UNIX tracks time in UTC format. It is the variable TZ that converts the UTC to local time.