Repository navigation
Conversation
Add a FILETIME-compatible clock, checked duration conversions, chrono-aware waits, threadpool timer scheduling, and optional C++/WinRT adapters. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 050afc68-9022-4f2f-9a9a-987dced5b550
Reuse the existing FILETIME conversion helpers through a dependency-light header, preserve their bit_cast path, centralize conversion constants, follow WIL output-pointer and Win32 error conventions, and improve API examples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 050afc68-9022-4f2f-9a9a-987dced5b550
Address additional review feedback, preserve integral FILETIME precision for arbitrary duration ratios, allow the full DWORD range for threadpool period and window values, add WIL-style API examples, and expand FILETIME and C++20 formatting tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 050afc68-9022-4f2f-9a9a-987dced5b550
Reject floating-point input durations and reduced conversion ratios that require both multiplication and division. Replace the general multiply-divide implementation with checked integral floor and ceiling paths, and add compile-time API availability tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7561362c-3628-46e5-a334-ec4f31808685
Remove the duplicate WIL clock and file-time wrapper. Keep generic duration and relative timer helpers independent, and conditionally enable absolute time helpers from winrt::clock when winrt/base.h is available. Reject custom unsigned duration representations and simplify the remaining checked ceiling conversion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7561362c-3628-46e5-a334-ec4f31808685
Restore win32_helpers.h to its original layout and remove the extracted filetime_helpers.h header. Chrono now keeps only its 100-nanosecond period and a private uint64-to-FILETIME packer, avoiding the resource/win32_helpers include cycle without moving existing APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7561362c-3628-46e5-a334-ec4f31808685
Remove the private FILETIME packer and WIL FILETIME-period alias. Enable relative FILETIME and threadpool timer helpers only with C++/WinRT, using winrt::file_time for raw encodings and winrt::clock for absolute conversions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7561362c-3628-46e5-a334-ec4f31808685
Keep SYSTEMTIME conversion explicit at call sites by composing winrt::clock FILETIME conversion with the existing Win32 APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7561362c-3628-46e5-a334-ec4f31808685
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7561362c-3628-46e5-a334-ec4f31808685
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
winrt::clockandwinrt::file_timeWIL_NO_CHRONOcontainmentDesign
This is a focused replacement proposal informed by the Windows clock work and review feedback in #89. It does not introduce another Windows clock or FILETIME wrapper: C++/WinRT integrations use the existing
winrt::clockandwinrt::file_timetypes directly.The generic duration helpers are available without C++/WinRT:
try_to_dword_ms,to_dword_ms_failfast, and exception-enabledto_dword_msconvert finite timeouts, round positive fractional milliseconds upward, reserveINFINITE, and reject negative or overflowing values.to_float_msconverts integral durations to fractional milliseconds for measurement and telemetry.To keep conversion behavior simple and predictable, input durations must use a signed integral representation and a reduced period conversion that requires multiplication or division, but not both. Floating-point, unsigned, and unusual mixed-ratio inputs are rejected at compile time; callers can explicitly
duration_castwhen intentional.When
<winrt/base.h>is available, re-including<wil/chrono.h>enables the Windows-time surface:winrt::file_timeforSetThreadpoolTimer;winrt::clock::time_pointorstd::chrono::system_clock::time_pointand convert throughwinrt::clock;No
wil::clock, WIL FILETIME wrapper, SYSTEMTIME wrapper family, custom formatter, or general arbitrary-ratio multiply/divide implementation is added. Callers can use the existing Win32 FILETIME/SYSTEMTIME APIs directly and format withstd::formatafterwinrt::clock::to_sys(value).Validation
The focused chrono tests build and run in these configurations:
witestwitest.noexceptwitest.win7witest.cpplatestCoverage includes timeout ceiling and overflow behavior, telemetry conversion, compile-time rejection of unsupported duration representations and ratios, chrono event waits, relative FILETIME encoding through
winrt::file_time, live relative and absolute threadpool timer callbacks,winrt::clock/system_clockconversion, and C++20std::formatusage.Latest focused result: 96 assertions across 14 test-case executions (
18 assertions / 3 casesin each C++17 target and42 assertions / 5 casesin the latest C++/C++WinRT target).