-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak corresponding quantity for main chrono types (#276)
Currently, we have a single generic correspondence for all chrono durations. This is perfectly unit safe, but it means we have no labels for any duration type, including common types like `std::chrono::hours`. This means that `as_quantity(std::chrono::hours{3})` would print as `"3 [UNLABELED UNIT]"` instead of `"3 h"`. This PR defines a special correspondence for each commonly used chrono duration type, which fixes the above behaviour. As part of doing this, we found a missing dependency on `:quantity`, so we added it in the BUILD file. Fixes #216. --------- Co-authored-by: Michael Hordijk <[email protected]>
- Loading branch information
1 parent
40c8e0c
commit f77cc5e
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -160,6 +160,8 @@ cc_library( | |
includes = ["code"], | ||
deps = [ | ||
":units", | ||
":prefix", | ||
":quantity", | ||
], | ||
) | ||
|
||
|
This file contains 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 |
---|---|---|
|
@@ -37,6 +37,7 @@ header_only_library( | |
HEADERS | ||
chrono_interop.hh | ||
DEPS | ||
prefix | ||
quantity | ||
units | ||
GTEST_SRCS | ||
|
This file contains 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 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