Skip to content

[CDRIVER-6048] Add New Time and Duration Functionality #2074

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

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
524ca34
New `duration` type
vector-of-bool Apr 14, 2025
e8a607b
Add a shim header for including Win32 APIs
vector-of-bool Apr 15, 2025
4f66d77
New time point and sleeping functions
vector-of-bool Apr 15, 2025
a69e197
[fixup] Fix preproc error in #error directive
vector-of-bool Apr 16, 2025
381aba5
Convert all sleeps to use duration-typed sleeps
vector-of-bool Apr 16, 2025
9fbc463
Support infix syntax for duration comparisons
vector-of-bool Apr 16, 2025
d403401
Infix syntax for time comparison
vector-of-bool Apr 16, 2025
8641196
Fix detection of POSIX clocks on libmuslc
vector-of-bool Apr 18, 2025
33c73e9
[fixup] Header ordering for Win32
vector-of-bool Apr 18, 2025
6b68bcb
More integer comparison assertions
vector-of-bool Apr 18, 2025
d08ebe2
A deadline timer type
vector-of-bool Apr 18, 2025
eb4482d
More doc and copyright comments
vector-of-bool Apr 18, 2025
3f4d645
Use Win32 QueryPerformanceCounter for getting times
vector-of-bool Apr 18, 2025
fda1736
Change windows-lean for a general platform header
vector-of-bool Apr 21, 2025
edd30fc
Set an appropriate Windows version
vector-of-bool Apr 21, 2025
e7f39f8
[fixup] macos compat
vector-of-bool Apr 21, 2025
aa23a28
Make duration API significantly more concise.
vector-of-bool Jul 10, 2025
feb4836
Clean up some macro magic
vector-of-bool Jul 11, 2025
1b38434
Merge branch 'master' into CDRIVER-6048-time-types
vector-of-bool Jul 11, 2025
d5704de
Fix up macro expansion to support nested expressions
vector-of-bool Jul 11, 2025
af1e828
More duration for mlib_later
vector-of-bool Jul 11, 2025
c44fdfa
Fix MSVC preproc disagreements
vector-of-bool Jul 11, 2025
a953be2
Formatting
vector-of-bool Jul 11, 2025
f5501a4
Clean up macro definitions
vector-of-bool Jul 14, 2025
7dbccb6
Use mlib_now() in bson monotonic time
vector-of-bool Jul 14, 2025
864b352
More time convenience APIs
vector-of-bool Jul 23, 2025
4865813
Cleanup
vector-of-bool Jul 23, 2025
38fc430
Refactor of async command to use new time APIs
vector-of-bool Jul 23, 2025
f72cd5a
Rename a lot of private command object attributes
vector-of-bool Jul 23, 2025
bde8406
Rename accidental duplicate test case
vector-of-bool Jul 23, 2025
a23c8eb
[fixup] Missing updates in conditional sections
vector-of-bool Jul 23, 2025
5c76085
[fixup] Time member rename in Windows
vector-of-bool Jul 23, 2025
b7628ec
[fixup] More conditional compilation misses
vector-of-bool Jul 23, 2025
55ed326
Fix dead-write warning and simplify some macro usage
vector-of-bool Jul 23, 2025
c40bffc
Fix: Wrong state when setting cancellation
vector-of-bool Jul 23, 2025
af308c8
Merge branch 'master' into CDRIVER-6048-time-types
vector-of-bool Jul 23, 2025
c623b52
Fix: sleep_for not using the checked useconds value
vector-of-bool Jul 24, 2025
3e7bb31
Test case cleanup
vector-of-bool Jul 24, 2025
161c403
Comment cleanup and spelling in async-cmd
vector-of-bool Jul 24, 2025
52e9a14
Remove unneeded inclusions following a goofy merge
vector-of-bool Jul 24, 2025
4eba25c
Drop more unneeded headers
vector-of-bool Jul 24, 2025
b6aea1e
Fix copyright statements
vector-of-bool Jul 30, 2025
41c978e
const correctness
vector-of-bool Jul 30, 2025
36a1cda
Missing headers for sleep()
vector-of-bool Jul 30, 2025
d362230
Rewrite some test macros as duration types
vector-of-bool Jul 30, 2025
3e29b8f
Tweak spelling of seconds suffix, add hour suffix
vector-of-bool Jul 30, 2025
07c2568
Drive-by timer change
vector-of-bool Jul 30, 2025
1232d46
Add a function to get the cock ID for mlib_now()
vector-of-bool Jul 31, 2025
9f3b192
Tweaks following PR reviews
vector-of-bool Aug 6, 2025
6aa01b7
`MLIB_DEFERRED` macro for simpler macro magic
vector-of-bool Aug 6, 2025
d7031fe
Rewrtie client_pool_pop() to use our timer type
vector-of-bool Aug 6, 2025
0e4718a
Remove <features.h> inclusion
vector-of-bool Aug 6, 2025
a7336f4
Make cancellation requests conditional on non-error states
vector-of-bool Aug 7, 2025
190086a
Minor spelling and name changes
vector-of-bool Aug 8, 2025
43e349d
Change topology scanner to use typed times
vector-of-bool Aug 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/common/src/mlib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,16 @@
MLIB_JUST(_mlibPickSixteenth \
MLIB_NOTHING("MSVC workaround") \
(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, ~))
// Expands to a single comma if invoked as a function-like macro
#define _mlibCommaIfParens(...) ,

/**
* @brief Expands to `1` if the given macro argument is a parenthesized group of
* tokens, otherwize `0`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* tokens, otherwize `0`
* tokens, otherwise `0`

*/
#define MLIB_IS_PARENTHESIZED(X) \
_mlibHasComma(_mlibCommaIfParens X MLIB_NOTHING("Inhibit immediate expansion: " #X))

/**
* A helper for isEmpty(): If given (0, 0, 0, 1), expands as:
* - first: _mlibHasComma(_mlibIsEmptyCase_0001)
Expand Down Expand Up @@ -147,8 +155,8 @@
* @brief Expand to a call expression `Prefix##_argc_N(...)`, where `N` is the
* number of macro arguments.
*/
#define MLIB_ARGC_PICK(Prefix, ...) \
MLIB_JUST (MLIB_PASTE_3 (Prefix, _argc_, MLIB_ARG_COUNT (__VA_ARGS__)) (__VA_ARGS__))
#define MLIB_ARGC_PICK(Prefix, ...) MLIB_EVAL_4 (MLIB_ARGC_PASTE (Prefix, __VA_ARGS__) (__VA_ARGS__))
#define MLIB_ARGC_PASTE(Prefix, ...) MLIB_PASTE_3 (Prefix, _argc_, MLIB_ARG_COUNT (__VA_ARGS__))

#ifdef __cplusplus
#define mlib_is_cxx() 1
Expand Down
Loading