Skip to content

Commit

Permalink
Fixed conversion stack-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MicheleCeresoli committed Jul 29, 2024
1 parent 5df4d72 commit 722d518
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/duration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ value(d::Duration{T}) where T = d.seconds + d.fraction
# ---
# Type Conversions and Promotions

function Base.convert(::Type{Duration{T}}, d::Duration{S}) where {T,S}
return Duration(d.seconds, convert(T, d.fraction))
end

function Base.convert(::Type{T}, d::Duration{S}) where {T<:Number,S}
return Duration(d.seconds, convert(T, d.fraction))
end
Expand Down

0 comments on commit 722d518

Please sign in to comment.