-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<chrono>
: Optimize to_sys
and to_local
#3579
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -502,6 +502,12 @@ void __stdcall __std_tzdb_delete_current_zone(__std_tzdb_current_zone_info* cons | |
return _Report_error(_Info, __std_tzdb_error::_Win_error); | ||
} | ||
|
||
// Get the option stored after the time zone name. If there's no option, _Tz[_Tz_len] is the null terminator in the | ||
// std::string, and will be treated the same as __std_tzdb_sys_info_type::_Full. | ||
const auto _Type = static_cast<__std_tzdb_sys_info_type>(_Tz[_Tz_len]); | ||
|
||
// TRANSITION, vNext | ||
// Profiling shows that _Get_cal is a hot path. Its result should be cached (preferably in the time_zone object). | ||
const auto _Cal = _Get_cal(_Tz, _Tz_len, _Info->_Err); | ||
if (_Cal == nullptr) { | ||
return _Propagate_error(_Info); | ||
|
@@ -528,6 +534,10 @@ void __stdcall __std_tzdb_delete_current_zone(__std_tzdb_current_zone_info* cons | |
return _Report_error(_Info, __std_tzdb_error::_Icu_error); | ||
} | ||
|
||
if (_Type == __std_tzdb_sys_info_type::_Offset_only) { | ||
return _Info.release(); | ||
} | ||
|
||
UDate _Transition{}; | ||
_Info->_Begin = __icu_ucal_getTimeZoneTransitionDate(_Cal.get(), | ||
UTimeZoneTransitionType::UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE, &_Transition, &_UErr) | ||
|
@@ -545,6 +555,10 @@ void __stdcall __std_tzdb_delete_current_zone(__std_tzdb_current_zone_info* cons | |
return _Report_error(_Info, __std_tzdb_error::_Icu_error); | ||
} | ||
|
||
if (_Type == __std_tzdb_sys_info_type::_Offset_and_range) { | ||
return _Info.release(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noting that if |
||
|
||
int32_t _Abbrev_len{}; | ||
const auto _Abbrev = _Get_timezone_short_id(_Cal.get(), _Is_daylight, _Abbrev_len, _Info->_Err); | ||
if (_Abbrev == nullptr) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.