Skip to content

Conversation

@d-winsor
Copy link
Contributor

@d-winsor d-winsor commented Mar 9, 2021

Works toward #12

This is part 1 of an implementation of time_zones that retrieves IANA database information by dynamically loading the icu.dll available in certain builds of windows.

This PR handles all the infrastructure of consuming ICU Apis and loading the time_zone & time_zone_link names. Part 2 will build on everything here to handle the time_zone transitions and sys_time to local_time. The content of Part 2 is mostly straightforward but verbose so I left to simply review.

I have scattered // FIXME: comments in the code where I either unsure of the right approach or would like to discuss design limitations of using the ICU API surface. The long list of names in the tests will be removed and exist only to demonstrate limitations.

@d-winsor d-winsor requested a review from a team as a code owner March 9, 2021 03:59
@StephanTLavavej StephanTLavavej added chrono C++20 chrono cxx20 C++20 feature labels Mar 9, 2021
Copy link
Contributor

@mnatsuhara mnatsuhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'v reviewed everything except the big stuff (<chrono>, and tests) - the ICU / Windows-y stuff takes me a bit longer to wrap my head around, so that's what I focused on today.

Copy link
Contributor

@mnatsuhara mnatsuhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed <chrono> -- next up: tests!

stl/inc/chrono Outdated
Comment on lines 2558 to 2559
_Tzdb_list.emplace_front(
tzdb{_STD move(_Time_zones), _STD move(_Links), _STD move(_Leap_sec), _All_ls_positive});
Copy link
Contributor

@mnatsuhara mnatsuhara Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the incompatibility (probably error?) that you're seeing? I don't think __cpp_lib_constexpr_dynamic_alloc would be relevant here since these aren't constexpry classes (the only constexpred things in all of [time.zone] are in leap_second and local_info). std::construct_at generally speaking should be equivalent to a placement new (except it's blessed by the constexpr fairy)-- if we have differing compiler behavior here (OK for cl, not OK for clang-cl and EDG) then we need to determine who is right and potentially file some bugs 🐞

Copy link
Contributor

@mnatsuhara mnatsuhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with suggestions! Only one comment is actually actionable -- we should decide whether we want to address the versioning question in this PR or if we should make a card for the project and fix it in a follow up PR (I'm leaning toward this option in the interest of expediency).

Comment on lines +2569 to +2570
_Tzdb_list.emplace_front(
tzdb{_Tzdb.version, _STD move(_Zones), _STD move(_Links), _STD move(_Leap_sec), _All_ls_positive});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is the case when we are actually updating information in the tzdb (because there are new leap_seconds to keep track of) we should change the version of the tzdb before emplacing it back (since things like reload_tzdb() and remote_version() use the version to differentiate between different information they contain). Right now we're getting the version from ICU, but I don't think that'll be sufficient because we'll also need to factor in leap seconds data. We need to come up with a better versioning system here...

I don't want this to hold up this PR because there is other work built on top of this, so I'm also fine with filing a card in the chrono project to revisit this in a follow-up PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me, lets revisit this

Co-authored-by: mnatsuhara <46756417+mnatsuhara@users.noreply.github.com>
@mnatsuhara mnatsuhara merged commit bf56ad9 into microsoft:feature/chrono Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chrono C++20 chrono cxx20 C++20 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants