From 42649e00e0e99fb8b5aa24e06402ce7892d7c3db Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 15 Mar 2024 02:52:14 +0100 Subject: [PATCH] don't overwrite last setup-tz cache via gmt-tz (special case) --- generic/tclClock.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index c7ae420..141ad58 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -943,6 +943,17 @@ TimezoneLoaded( Tcl_Obj *timezoneObj, /* Name of zone was loaded */ Tcl_Obj *tzUnnormObj) /* Name of zone was loaded */ { + /* don't overwrite last-setup with GMT (special case) */ + if (timezoneObj == dataPtr->literals[LIT_GMT]) { + /* mark GMT zone loaded */ + if (dataPtr->gmtSetupTimeZone == NULL) { + Tcl_SetObjRef(dataPtr->gmtSetupTimeZone, + dataPtr->literals[LIT_GMT]); + } + Tcl_SetObjRef(dataPtr->gmtSetupTimeZoneUnnorm, tzUnnormObj); + return; + } + /* last setup zone loaded */ if (dataPtr->lastSetupTimeZone != timezoneObj) { SavePrevTimezoneObj(dataPtr); @@ -950,14 +961,6 @@ TimezoneLoaded( Tcl_UnsetObjRef(dataPtr->lastSetupTZData); } Tcl_SetObjRef(dataPtr->lastSetupTimeZoneUnnorm, tzUnnormObj); - - /* mark GMT zone loaded */ - if ( dataPtr->gmtSetupTimeZone == NULL - && timezoneObj == dataPtr->literals[LIT_GMT] - ) { - Tcl_SetObjRef(dataPtr->gmtSetupTimeZone, - dataPtr->literals[LIT_GMT]); - } } /* *----------------------------------------------------------------------