Skip to content
Tcl Source Code View Ticket
Login

View Ticket

FreeScan resp. Oldscan does not recognize positive time zone offset like "31 Jan 14 23:59:59 +0100"

Closed / Fixed5019748c731bb93d42170f76b55e22c328cd2409Created 11 years agoUpdated 6 years ago
Descriptionplain2015-07-08 10:04:59
FreeScan resp. Oldscan does not recognize positive time zone offset like 
"31 Jan 14 23:59:59 +0100".

% clock scan "31 Jan 14 23:59:59 -0100"
1391216399
% clock scan "31 Jan 14 23:59:59 +0100"
unable to convert date-time string "31 Jan 14 23:59:59 +0100": syntax error (characters 24-24)

Fixed within [5f72c863f17145b4ca20de5b44ad12a35d657dac].

Additionally fixes another worse issue, invalid recognition a relative time (relspec) as time zone, example:

% clock format [clock scan "31 Jan 14 23:59:59 -100 days"] -format "%D %T"
02/02/2014 01:59:59

Should recognize here a relspec (day unit) not TZ, so the value is imho invalid.
Execution in new version:
% clock format [clock scan "31 Jan 14 23:59:59 -100 days"] -format "%D %T"
10/23/2013 23:59:59
Referenced by5
  • 664c7b4f93Closed ticket [1386377fff]: clock scan [clock format [clock seconds] -gmt 1] plus 4 other changes ticket2026-10-21 10:03:38
  • f041312885Fix [5019748c73]: FreeScan resp. Oldscan does not recognize positive time zone offset check-in2020-07-10 10:03:53
  • 4f71ead4a9Proposed fix for [5019748c73]: FreeScan resp. Oldscan does not recognize positive time zone offset like "31 Jan 14 23:59:59 +0100" check-in2020-07-09 07:57:32
  • e3b56c8573Ticket [a1bd37b719] clock (free)scan of ISO 8601 timestamp with literal T behaves strange status still Open with 3 other changes ticket2020-07-08 15:55:02
  • 5bf5a9c2f1Pending ticket [ddc948cff9]: Tcl-clock speed-up / flightaware Tcl-bounties#4 plus 4 other changes ticket2018-05-29 18:21:07
sebres Pending ticket [5019748c73]. [History diff]2015-07-08 10:06:10
sebresplain2015-07-08 10:14:00
Because of possible conflict needs testing, so testers are welcome.
dgp Ticket [5019748c73]: 3 changes [History diff]2015-07-08 14:33:46
sebresplain2015-07-28 10:47:12
ping (someone has tested?)
sebreswiki2017-10-28 13:37:24

I've rewritten this handling for new clock-engine, see tclclockmod/#9. Additionally rewritten the free scan yacc rules and some tokens for better space recognition, fewer conflicts (shift/reduce, reduce/reduce);

Differentiate between TZ like "GMT+1" and relative offsets "GMT +1 day", etc.;

Test-cases extended for new cases.

jan.nijtmanswiki2020-07-09 08:00:08

Whow, another clock-related bug which has a fix, but was untouched for 5 years....

Solution separated in its own branch: [4f71ead4a98a0e6c]. Let's see what Travis thinks of this and then merge to core-8-6-branch.

jan.nijtmanswiki2020-07-10 10:42:51

Fixed now in core-8-6-branch and up.

@sebres, this doesn't contain the enhancements in the new clock-engine, as mentioned 2017-10-28, so if you like to backport those to bare Tcl 8.6 too .....

dgpplain2020-07-10 18:43:55
New test failures on core-8-6-branch, I think from this work:

==== clock-34.61 clock scan tests (-TZ) FAILED
==== Contents of test case:

    set time [clock scan "23:59:59 -0100" -base 0]
    clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true

---- Result was:
Jan 01,1970 00:59:59 GMT
---- Result should have been (exact matching):
Jan 02,1970 00:59:59 GMT
==== clock-34.61 FAILED



==== clock-34.62 clock scan tests (+TZ) FAILED
==== Contents of test case:

    set time [clock scan "23:59:59 +0100" -base 0]
    clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true

---- Result was:
Dec 31,1969 22:59:59 GMT
---- Result should have been (exact matching):
Jan 01,1970 22:59:59 GMT
==== clock-34.62 FAILED



==== clock-34.67 clock scan tests (merid and TZ) FAILED
==== Contents of test case:

    set time [clock scan "10:59 pm CET" -base 2000000]
    clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true

---- Result was:
Jan 23,1970 21:59:00 GMT
---- Result should have been (exact matching):
Jan 24,1970 21:59:00 GMT
==== clock-34.67 FAILED



==== clock-34.68 clock scan tests (merid and TZ) FAILED
==== Contents of test case:

    set time [clock scan "10:59 pm +0100" -base 2000000]
    clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true

---- Result was:
Jan 23,1970 21:59:00 GMT
---- Result should have been (exact matching):
Jan 24,1970 21:59:00 GMT
==== clock-34.68 FAILED
jan.nijtmanswiki2020-07-13 08:46:44

@dgp, those 4 test-cases should be fixed now. Since the "-base" option doesn't imply "-gmt true", those testcases were timezone-dependent. Apparently, for negative timezones they fail therefore sebres and I didn't notice this.

It looks like Travis operates in timezone GMT. That's useful, so we now can be reasonable sure that they work for all timezones.

Log in (anonymous is fine) to add a comment.