Skip to content
Tcl Source Code View Ticket
Login

View Ticket

clock scan - timezones like +200 generate error

Deleted219337ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 22 years ago
Descriptionplain2000-10-26 05:10:57
OriginalBugID: 5297 Bug
Version: 8.3
SubmitDate: '2000-04-28'
LastModified: '2000-06-26'
Severity: SER
Status: UnAssn
Submitter: techsupp
ChangedBy: ericm
RelatedBugIDs: 4862
OS: All
OSVersion: NT 4.0,  RedHat Linux 6.2, AIX 4.1
Machine: various IBM PCs, IBM RS/6000
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:

Borivoj Tydlitat


Extensions:

none in this case


CustomShell:

no


Comments:

The above yacc grammar has two branches with hard-coded '-' sign before

    TZ offset. 

    Just added two more with '+' sign.


ReproducibleScript:

% clock scan {3/1 12:00 est}

951930000

% clock scan {3/1 18:00 cet}

951930000

% clock scan {3/1 12:00 -0500}

951930000

% clock scan {3/1 18:00 +0100}

unable to convert date-time string "3/1 18:00 +0100"


ObservedBehavior:

Error converting times with timezone expressed as positive hhmm offset: +hmm (i.e. eastern hemisphere timezones).

Timezones with negative offset, symbolic names or military codes seem to work OK.


DesiredBehavior:

Apparently the date/time formats covered by the clock scan command attempt to conform to RFC 822. Therefore timezone fields like +1100  should be processed the same way e.g. -0500 is, and not be rejected as incorrect format.


Patch:

*** tclGetDate.y.old    Fri Apr 28 13:28:21 2000

--- tclGetDate.y        Fri Apr 28 13:30:28 2000

***************

*** 205,210 ****

--- 205,217 ----

              yyDSTmode = DSToff;

              yyTimezone = ($5 % 100 + ($5 / 100) * 60);

          }

+         | tUNUMBER ':' tUNUMBER '+' tUNUMBER {

+             yyHour = $1;

+             yyMinutes = $3;

+             yyMeridian = MER24;

+             yyDSTmode = DSToff;

+             yyTimezone = -($5 % 100 + ($5 / 100) * 60);

+         }

          | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {

              yyHour = $1;

              yyMinutes = $3;

***************

*** 219,225 ****

              yyDSTmode = DSToff;

              yyTimezone = ($7 % 100 + ($7 / 100) * 60);

          }

!         ;


  zone    : tZONE tDST {

              yyTimezone = $1;

--- 226,240 ----

              yyDSTmode = DSToff;

              yyTimezone = ($7 % 100 + ($7 / 100) * 60);

          }

!         | tUNUMBER ':' tUNUMBER ':' tUNUMBER '+' tUNUMBER {

!             yyHour = $1;

!             yyMinutes = $3;

!             yySeconds = $5;

!             yyMeridian = MER24;

!             yyDSTmode = DSToff;

!             yyTimezone = -($7 % 100 + ($7 / 100) * 60);

!         }

!       ;


  zone    : tZONE tDST {

              yyTimezone = $1;


PatchFiles:

generic/tclGetDate.y




There is a backwards compatibility issue with this change.  Prior to using it:

% clock scan "12:00 +1000 seconds"
962047000

After applying it:

% clock scan "12:00 +1000 seconds"
961984801

The grammar is such that the "+1000" is greedily consumed as a timezone for "12:00" rather than a multiplier for "seconds".  This may be fixable with a better grammar; really, as I've said before, the clock grammar needs a complete overhaul (13 shift/reduce conflicts is obscene).

- eric

-- 06/26/2000 ericm
dgp Ticket [219337ffff]: 2 changes [History diff]2001-02-08 12:26:29
kennykbplain2004-08-19 21:05:24
Logged In: YES 
user_id=99768

Closed along with 219339.
Log in (anonymous is fine) to add a comment.