You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implicit cast between Duration and TimeSpan (#1365)
### Changes
- Change `Duration` from explicit to implicit cast to/from `TimeSpan`
- Remove operator overloads for `TimeSpan` now covered by implicit cast for all but left operands
### Background
See #1354 (comment)
One issue is that the operator overloads only work when `TimeSpan` is the right operand.
I changed the code generation to take this into account, but another option would be to make a breaking change where we just don't support `TimeSpan` as the left operand at all.
Then users would have to cast explicitly, or for multiplication just reverse the operands.
This would affect 13 operators:
```
TimeSpan * Acceleration
TimeSpan * ElectricCurrent
TimeSpan * ElectricCurrentGradient
TimeSpan * ForceChangeRate
TimeSpan * KinematicViscosity
TimeSpan * MassFlow
TimeSpan * MolarFlow
TimeSpan * Power
TimeSpan * PressureChangeRate
TimeSpan * RotationalSpeed
TimeSpan * Speed
TimeSpan * TemperatureChangeRate
TimeSpan * VolumeFlow
```
Of which only 6 are used in tests so I assume are supported in v5:
```
TimeSpan * KinematicViscosity
TimeSpan * MassFlow
TimeSpan * Power
TimeSpan * RotationalSpeed
TimeSpan * TemperatureChangeRate
TimeSpan * Speed
```
---------
Co-authored-by: Andreas Gullberg Larsen <[email protected]>
0 commit comments