Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about timezones and the clock command

41 views
Skip to first unread message

Arjen Markus

unread,
Jan 24, 2018, 7:47:07 AM1/24/18
to
Hello,

I have run into a problem with timezones for Tennessee, USA - the problem itself has nothing to do with Tcl, but I wanted to manipulate the times via Tcl. The timezone we are using is called CST - Central Standard Time (with or without daylight saving). But Tcl's clock does not know about this timezone (its name is rather ambiguous - both China and Cuba may be using a timezone with the very same name). So I wondered what the best way is to deal with this particular timezone in the [clock] command.

Any suggestions?

(Its definition is: -6 hours wrt UTC, but I have no idea about the dates for daylight saving)

Regards,

Arjen

Gerald Lester

unread,
Jan 24, 2018, 8:09:54 AM1/24/18
to
On 01/24/2018 06:47 AM, Arjen Markus wrote:
> Hello,
>
> I have run into a problem with timezones for Tennessee, USA - the problem itself has nothing to do with Tcl, but I wanted to manipulate the times via Tcl. The timezone we are using is called CST - Central Standard Time (with or without daylight saving). But Tcl's clock does not know about this timezone (its name is rather ambiguous - both China and Cuba may be using a timezone with the very same name). So I wondered what the best way is to deal with this particular timezone in the [clock] command.
>
> Any suggestions?

Reread the clock man/help/documentation page, particularly the "TIME
ZONE" section?

What OS are you running on?

Could you post an example of the [clock scan] or [clock format] that
does not work.


--
+----------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+----------------------------------------------------------------------+

Arjen Markus

unread,
Jan 24, 2018, 8:31:45 AM1/24/18
to
On Wednesday, January 24, 2018 at 2:09:54 PM UTC+1, Gerald Lester wrote:
> On 01/24/2018 06:47 AM, Arjen Markus wrote:
> > Hello,
> >
> > I have run into a problem with timezones for Tennessee, USA - the problem itself has nothing to do with Tcl, but I wanted to manipulate the times via Tcl. The timezone we are using is called CST - Central Standard Time (with or without daylight saving). But Tcl's clock does not know about this timezone (its name is rather ambiguous - both China and Cuba may be using a timezone with the very same name). So I wondered what the best way is to deal with this particular timezone in the [clock] command.
> >
> > Any suggestions?
>
> Reread the clock man/help/documentation page, particularly the "TIME
> ZONE" section?
>
> What OS are you running on?
>
> Could you post an example of the [clock scan] or [clock format] that
> does not work.
>

I simply thought I could use -timezone cst, but that is not defined. A quick check for a timezone form like ":America/New_York" revealed no immediate candidates in Tennessee.

Regards,

Arjen

Don Porter

unread,
Jan 24, 2018, 8:39:48 AM1/24/18
to
On 01/24/2018 08:09 AM, Gerald Lester wrote:
> Could you post an example of the [clock scan] or [clock format] that
> does not work.

% clock format [clock seconds] -timezone CST
time zone CST not found

Gotta say that surprises me.

A possible solution:

% clock format [clock seconds] -timezone America/Chicago
Wed Jan 24 07:37:52 CST 2018

--
| Don Porter Applied and Computational Mathematics Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

Arjen Markus

unread,
Jan 25, 2018, 3:43:02 AM1/25/18
to
On Wednesday, January 24, 2018 at 2:39:48 PM UTC+1, Don Porter wrote:

>
> A possible solution:
>
> % clock format [clock seconds] -timezone America/Chicago
> Wed Jan 24 07:37:52 CST 2018
>

I wanted to report a bug concerning this, but I found there is already a ticket that describes the problem as well as the solution:
https://core.tcl.tk/tcl/tktview/1656002fffffffffffff

The essence is the legacy timezone abbreviations are ambiguous and the documentation does state that such timezones are only recognised in the context of the %z or %Z group. So:

clock format [clock seconds] -timezone :America/Chicago

is the proper way.

Nevertheless:
- The legacy timezones get quite some exposure in the man page, where the proper zone name do not.
- There is no simple way to get the standardized name. I would not associate Chicago with the western part of Tennessee, for instance.
- These legacy timezones are still ubiquitous.

Perhaps we can add a translation table to the man page to make this easier?

I will create a new ticket with this suggestion.

Regards,

Arjen
0 new messages