diff options
author | sebres <sebres@users.sourceforge.net> | 2024-03-12 01:36:28 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2024-03-12 01:36:28 (GMT) |
commit | e3b1e4593761264e3b18d341ee1eb9833d0bad37 (patch) | |
tree | 841f22b949401bcc67fae3b0cdf34ce38caff26a /generic | |
parent | 83a74db91df83a3a4505472cd965d6d74e8ee7bc (diff) | |
download | tcl-e3b1e4593761264e3b18d341ee1eb9833d0bad37.zip tcl-e3b1e4593761264e3b18d341ee1eb9833d0bad37.tar.gz tcl-e3b1e4593761264e3b18d341ee1eb9833d0bad37.tar.bz2 |
optimize simplest case if numeric timezone is 0000 (so GMT/UTC)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclClock.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index 1c9f77e..5872ad1 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -4023,16 +4023,23 @@ ClockFreeScan( */ if (info->flags & CLF_ZONE) { - Tcl_Obj *tzObjStor = NULL; - int minEast = -yyTimezone; - int dstFlag = 1 - yyDSTmode; - tzObjStor = ClockFormatNumericTimeZone( - 60 * minEast + 3600 * dstFlag); - Tcl_IncrRefCount(tzObjStor); - - opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, tzObjStor); - - Tcl_DecrRefCount(tzObjStor); + if (yyTimezone || !yyDSTmode) { + /* Real time zone from numeric zone */ + Tcl_Obj *tzObjStor = NULL; + int minEast = -yyTimezone; + int dstFlag = 1 - yyDSTmode; + tzObjStor = ClockFormatNumericTimeZone( + 60 * minEast + 3600 * dstFlag); + Tcl_IncrRefCount(tzObjStor); + + opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, tzObjStor); + + Tcl_DecrRefCount(tzObjStor); + } else { + /* simplest case - GMT / UTC */ + opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, + dataPtr->literals[LIT_GMT]); + } if (opts->timezoneObj == NULL) { goto done; } |