[lug] Setting time zone

George Sexton gsexton at mhsoftware.com
Tue Aug 5 16:43:23 MDT 2008


Well, to be pedantic there are:

America/Phoenix
America/Indiana

I guess I don't understand why you're going to use a local time that 
will be wrong half the time. It seems like it would make more sense to 
either:

1) Log all times in GMT, which is the most sensible. Granted, I'm 
spoiled using Java which has very comprehensive time handling abilities. 
But still, you can use the gmtime() function in the standard C library 
to get time in GMT.

2) Set the system time for GMT and call it good. Then your code doesn't 
have to do anything with time conversion, and you can unambiguously 
convert to any other time zone.

Granted your approach will let you unambiguously convert to GMT, but 
anyone eye-balling the data will have to do a conversion to correlate 
the reading times to local time. The danger here is that people looking 
at the data may not realize that it's in a synthetic time zone.

Gary Hodges wrote:
> Actually, this is precisely my intention.  In this case I do not want my 
> computer to change to DST.  Back in the day I ran into problems when I 
> set up an instrument in the pacific time zone.  There isn't a 
> Continent/City setting that doesn't switch to DST like there is in the 
> other US time zones.
> 
> Gary
> 
> George Sexton wrote:
>> Uh, you should really select America/Chicago.
>>
>> Three letter time zones don't always mean what you think.
>>
>> I have had UK users select BST thinking it meant British Summer Time, 
>> but in the Olson db, it's Bering Standard Time. They would then call 
>> and complain the imports/exports were off by 10 hours.
>>
>> Another problem is that some time zones like EST implicitly don't have 
>> Daylight savings time in them. There's no rule in those zones for it.
>>
>> Really, really, follow the Continent/City convention for your time zone.
>>
>> In your example, where you're creating the TZ setting, there's no 
>> accomodation for DST. 1st Sunday in November, your clocks will be off 
>> by an hour.
>>
>> Gary Hodges wrote:
>>> On an Ubuntu system I'd like to set the time zone on a computer to 
>>> CST.  When I run "sudo tzselect" and go through the steps I get:
>>>
>>> ------------------------
>>> Please identify a location so that time zone rules can be set correctly.
>>> Please select a continent or ocean.
>>>  1) Africa
>>>  2) Americas
>>>  3) Antarctica
>>>  4) Arctic Ocean
>>>  5) Asia
>>>  6) Atlantic Ocean
>>>  7) Australia
>>>  8) Europe
>>>  9) Indian Ocean
>>> 10) Pacific Ocean
>>> 11) none - I want to specify the time zone using the Posix TZ format.
>>> #? 11
>>> Please enter the desired value of the TZ environment variable.
>>> For example, GST-10 is a zone named GST that is 10 hours ahead (east) 
>>> of UTC.
>>> CST+6
>>>
>>> The following information has been given:
>>>
>>>         TZ='CST+6'
>>>
>>> Therefore TZ='CST+6' will be used.
>>> Local time is now:      Tue Aug  5 09:42:30 CST 2008.
>>> Universal Time is now:  Tue Aug  5 15:42:30 UTC 2008.
>>> Is the above information OK?
>>> 1) Yes
>>> 2) No
>>> #? 1
>>>
>>> You can make this change permanent for yourself by appending the line
>>>         TZ='CST+6'; export TZ
>>> to the file '.profile' in your home directory; then log out and log 
>>> in again.
>>>
>>> Here is that TZ value again, this time on standard output so that you
>>> can use the /usr/bin/tzselect command in shell scripts:
>>> CST+6
>>> ------------------------
>>>
>>> But I want to set the time zone globally, not just for a particular 
>>> user.
>>>
>>> Gary
>>> _______________________________________________
>>> Web Page:  http://lug.boulder.co.us
>>> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>>> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>>
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug

-- 
George Sexton
MH Software, Inc.
Voice: +1 303 438 9585
URL:   http://www.mhsoftware.com/



More information about the LUG mailing list