-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clock scan/freescan deviation (wrong conversion) if TZ specified in the input #22
Comments
Branch fix-gh-22--fix-tz-bug-c6f1ffa7a9 would provide a fix for the issue... Currently it fixes only first part considering the time zones "+0100" and "GMT+1", "GMT+01", "GMT+01:00" differently, because mistakenly recognizes them as a backward posix TZ with offset from some TZ to Greenwich using Line 1010 in 53c4ee0
|
@kennykb Lines 1643 to 1647 in 53c4ee0
I did it because related to docu-comment in source code: Lines 1463 to 1467 in 53c4ee0
it must be a sign and offset "from Greenwich to the given time zone". But as I did it, I got a lot of fails in the test-cases (for example everywhere the zone Also I'm additionally confused because if the comment means it correctly as "from Greenwich to the given time zone", the timezone + % clock format [clock scan "01/01/1970 00:00:00" -timezone +0100] -gmt 1 -locale en
+ Wed Dec 31 23:00:00 GMT 1969
+ % clock format [clock scan "01/01/1970 00:00:00" -timezone CET] -gmt 1 -locale en
+ Wed Dec 31 23:00:00 GMT 1969
- % clock format [clock scan "01/01/1970 00:00:00" -timezone CET+01:00] -gmt 1 -locale en
- Thu Jan 01 01:00:00 GMT 1970 To be equal with I was able to fix it at another place in SetupTimeZone (where the numeric offset to GMT is checked via regex directly in SetupTimeZone). But I'd like to know we don't have a bug in |
@sebres Posix timezones have the signs reversed, don't they? EST5 means "Eastern Standard Time, which is 5 hours west of Greenwich". Which is. uhm, surprising, but "historical reasons" |
POSIX time zones have the sign reversed. CET-01:00 is correct for one hour
east of Greenwich. The comment might be better phrased as "the number of
hours that the given time zone is west of Greenwich."
…On Tue, Jul 12, 2022 at 2:08 PM Sergey G. Brester ***@***.***> wrote:
@kennykb <https://github.com/kennykb>
Initially I was trying to fix it inside of ParsePosixTimeZone, or either
in ProcessPosixTimeZone (I simply tried to switch the sign in offset
calculation here):
https://github.com/sebres/tclclockmod/blob/53c4ee003a08246d839924eba916338cc587692a/lib/clock.tcl#L1643-L1647
I did it because related to docu-comment in source code:
https://github.com/sebres/tclclockmod/blob/53c4ee003a08246d839924eba916338cc587692a/lib/clock.tcl#L1463-L1467
it must be a sign and offset *"from Greenwich to the given time zone"*.
But as I did it, I got a lot of fails in the test-cases (for example
everywhere the zone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00 is used).
Just I'm unsure the test results are artificially constructed or the
documented comment is wrong.
Also I'm additionally confused because if the comment means it correctly
as "from Greenwich to the given time zone", the timezone CET (which is
GMT+1) must be basically equal to CET+0100, but it is not the case at the
moment:
+ % clock format [clock scan "01/01/1970 00:00:00" -timezone +0100] -gmt 1 -locale en+ Wed Dec 31 23:00:00 GMT 1969+ % clock format [clock scan "01/01/1970 00:00:00" -timezone CET] -gmt 1 -locale en+ Wed Dec 31 23:00:00 GMT 1969- % clock format [clock scan "01/01/1970 00:00:00" -timezone CET+01:00] -gmt 1 -locale en- Thu Jan 01 01:00:00 GMT 1970
To be equal with CET I must supply CET-01:00 instead of CET+01:00 to
ParsePosixTimeZone/ProcessPosixTimeZone pair at the moment.
I was able to fix it at another place in SetupTimeZone (where the numeric
offset to GMT is checked via regex directly in SetupTimeZone
<https://github.com/sebres/tclclockmod/compare/fix-gh-22--fix-tz-bug-c6f1ffa7a9#diff-95a561147820abc322616b09cebea1d1219b8bf1596fc0074717f6ec2be82f74R973>
).
But I'd like to know we don't have a bug in
ParsePosixTimeZone/ProcessPosixTimeZone pair too, so if I working on few
TZ issues, I could solve this one too.
—
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABU6UOGNUVRYVKUF2KBO63VTWYBTANCNFSM5MIAPMQQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
73 de ke9tv/2, Kevin
|
Indeed. Found in the documentation an example for CET -
I have no issue with west/east sentence, but with "from Greenwich to the given time zone" either. - # stdSignum - Sign (+, -, or empty) of the offset from Greenwich
- # to the given (non-DST) time zone. + and the empty
+ # stdSignum - Sign (+, -, or empty) of the offset from the given
+ # (non-DST) time zone to Greenwich. + and the empty As for historical... What do you think about my fix here for "GMT±xxxx" and "UTC±xxxx" zones? Would it be legitimate at all? |
As discussed in Tcl chatroom (IRC) there is no graceful way to solve the For instance, using it in env TZ, that's what $ TZ=GMT date -d '1970-01-01 12:00 GMT' '+%H:%M %Z'
12:00 GMT
$ TZ=CET date -d '1970-01-01 12:00 GMT' '+%H:%M %Z'
13:00 CET
$ TZ=GMT+1 date -d '1970-01-01 12:00 GMT' '+%H:%M %Z'
11:00 GMT The conclusion implies that the fix must be rewritten to consider the TZ from input string and TZ from
|
Just a reminder to provide possible solution for https://core.tcl-lang.org/tcl/info/c6f1ffa7a9 (backport it from my tcl-fork as is?).
The text was updated successfully, but these errors were encountered: