-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
QE 2022-09-19, QE 2022-10-03
Whenever a time object is manipulated, the associated timezone is queried for its offset from the UTC, using these patterns:
void timelib_update_from_sse(timelib_time *tm)
...
gmt_offset = timelib_get_time_zone_info(tm->sse, tm->tz_info);
timelib_unixtime2gmt(tm, tm->sse + gmt_offset->offset);
timelib_time_offset_dtor(gmt_offset);
static void do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi) ... current = timelib_get_time_zone_info(tz->sse, tzi); after = timelib_get_time_zone_info(tz->sse - current->offset, tzi); tz->is_localtime = 1; in_transition = ( ((tz->sse - after->offset) >= (after->transition_time + (current->offset - after->offset))) && ((tz->sse - after->offset) < after->transition_time) ); if ((current->offset != after->offset) && !in_transition) { adjustment = -after->offset; } else { adjustment = -current->offset; } timelib_time_offset_dtor(current); timelib_time_offset_dtor(after);
Seconds TimeZone::utcOffset(Date_t date) const { if (isTimeZoneIDZone()) { auto* offset = timelib_get_time_zone_info( durationCount<Seconds>(date.toDurationSinceEpoch()), _tzInfo.get()); auto timezoneOffsetFromUTC = Seconds(offset->offset); timelib_time_offset_dtor(offset);
In these cases the caller is only interested in the offset from UTC, instead of the full set of information available from timelib_get_time_zone_info; using this API has the side effect of requiring the allocations and immediate deallocation of two memory buffers (for the returned struct and for the string representing the timezone name).
The code could use a simpler API similar to timelib_get_current_offset (that accepts a full timelib_time rather than the time and the timezone) in order to return just the offset without the extra information
- is depended on by
-
SERVER-60141 Upgrade timelib to 2021.09 or later
- Closed