Tcl Source Code

View Ticket
Login
Ticket UUID: 5019748c731bb93d42170f76b55e22c328cd2409
Title: FreeScan resp. Oldscan does not recognize positive time zone offset like "31 Jan 14 23:59:59 +0100"
Type: Bug Created on: 2015-07-08 10:04:59
Submitter: sebres Assigned to: jan.nijtmans
Subsystem: 16. Commands A-H Severity: Minor
Priority: 5 Medium Last modified: 2020-07-13 08:46:44
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2020-07-13 08:46:44
Version: 8.6
Description:
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
User Comments:
sebres added on 2015-07-08 10:14:00:
Because of possible conflict needs testing, so testers are welcome.

sebres added on 2015-07-28 10:47:12:
ping (someone has tested?)

sebres added on 2017-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.nijtmans added on 2020-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.nijtmans added on 2020-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 .....


dgp added on 2020-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.nijtmans added on 2020-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.