Operating System - HP-UX
1748122 Members
3586 Online
108758 Solutions
New Discussion юеВ

ntp U.S. Time Zone Conversions

 
Cary Farah
Frequent Advisor

ntp U.S. Time Zone Conversions

Im running a ntp server (central daylight time) and now i want to sync a sco box to the ntp but it uses cst(central standard time) the problem is that it's an hour ahead when in daylight savings time. is there a way to convert the ntp to cst?
9 REPLIES 9
John Poff
Honored Contributor

Re: ntp U.S. Time Zone Conversions

Hi,

I have HP-UX boxes across two time zones synced to a ntp time server, and I don't have to do anything to handle the time zones. I assume that each box handles the conversion using their local /etc/TIMEZONE file settings. It should just do the right thing if each box is setup correctly for their individual time zones.

JP
James R. Ferguson
Acclaimed Contributor

Re: ntp U.S. Time Zone Conversions

Hi Cary:

There is nothing you need to do. 'ntp' traffics in UTC (GMT). Your local timezone (TZ) setting turns the universal clock into your local one for display purposes.

Regards!

...JRF...
Cary Farah
Frequent Advisor

Re: ntp U.S. Time Zone Conversions

Because of a bug in the apilcation i have to manually set the time for daylight in other words im an hour behind since the time zone is cst, in other words i need someway to trick it into thinking it's cdt rather than cst because of this app has bugs and they dont want to fix it.
James R. Ferguson
Acclaimed Contributor

Re: ntp U.S. Time Zone Conversions

Hi (again) Cary:

Your application could set its TZ to what it needed. For example, I'm in US Eastern time.

# date
Wed Oct 2 15:56:24 EDT 2002

# TZ=AST4ADT date
Wed Oct 2 16:56:24 ADT 2002

# TZ=CST6CDT date
Wed Oct 2 14:57:23 CDT 2002

...so, for the purposes of what my application sees (here, the 'date' command), the date can be displayed as I choose. Note that the above syntax changes the TZ variable only for the duration of the commandline.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: ntp U.S. Time Zone Conversions

As has been mentioned, NTP has absolutely nothing to do with timezones. All UNIX boxes in the known universe simply count time from the beginning of the world (1/1/1970). What differs is how the time is displayed. All you probably need to do is create a wrapper around your application that exports TZ and then invokes the real application. I would keep this special TZ is a file so that if you have multiple wrappers then you only need to change it in 1 place.

If it ain't broke, I can fix that.
Cary Farah
Frequent Advisor

Re: ntp U.S. Time Zone Conversions

I think im asking the impossible...I have to keep the box central standard time (TZ=CST6) yet when in daylight saving time (an hour behind) keep the box thinking it's cst, when in fact it's (TZ=CST6CDT)daylight time.
James R. Ferguson
Acclaimed Contributor

Re: ntp U.S. Time Zone Conversions

Hi Cary:

Again, don't fiddle with the TZ of the server. Rather, in the application's environment (as already noted), change the TZ value as you require. You could invent your own timezone and define it in '/usr/lib/tztab' as needed. See 'man 4 tztab' for more details.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: ntp U.S. Time Zone Conversions

As mentioned, your computer is never going to keep time based on CST or do anything during daylight saving transitions. Your computer is keeping time in UTC or Zulu time.

When you type the date command, what you see is an automatic translation. Do this:

TZ=PST8PDT date
TZ=CST6 date
TZ=EST5EDT date

AS you can see, your HP-UX box has every timezone available...jsut set the TZ value.

But your SCO box is Unix too and ntp on the SCO box will set the exact same time, that is, UTC or Zulu time, which is exactly what you want. Then in SCO, find out how to define the local timezone and magically, you can set any timezone you want.

Unix is much too smart to pay any attention to timezones which is why a timezone variable exists. That way, anyone can login anywhere in the world and see their local time.


Bill Hassell, sysadmin
Cary Farah
Frequent Advisor

Re: ntp U.S. Time Zone Conversions

thanks for all the help