[SERVER-43300] Add literal operators for time types Created: 12/Sep/19 Updated: 06/Dec/22 Resolved: 30/Jun/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Geert Bosch | Assignee: | Backlog - Service Architecture |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Service Arch
|
| Participants: |
| Description |
|
The new C++ <chrono> library allows writing time constants in the natural way such as 5ms. However, because we define our own internal duration types, we cannot use those and still have to write Milliseconds(5), etc. This is harder to read and write. Current usages are:
|
| Comments |
| Comment by Mira Carey [ 30/Jun/20 ] |
|
Given the lack of triviality mentioned by geert.bosch and that we're only increasing conciseness of literals, I don't see us getting to this and so am declining |
| Comment by Andrew Morrow (Inactive) [ 16/Sep/19 ] |
|
This is a good idea, but not urgent. |
| Comment by Geert Bosch [ 13/Sep/19 ] |
|
I thought I'd just do it, but it turns out that literal operators take unsigned numbers and checking at compile time whether they'll overflow when casted to signed is non-trivial. |