Skip to content

Commit

Permalink
update _seconds2string
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrodium committed Jan 30, 2024
1 parent 66ac5fb commit 0bd4667
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/_newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ _abbstr(t::Millisecond) = string(t.value) * "ms "
_abbstr(t::Vector{Period}) = *(_abbstr.(t)...)[1:end-1]

function _seconds2string(Δt::Float64)
prds = Dates.canonicalize(Dates.CompoundPeriod(Dates.Millisecond(floor(1000Δt)))).periods
return _abbstr(prds)
periods = Dates.canonicalize(Dates.CompoundPeriod(Dates.Millisecond(floor(1000Δt)))).periods
if isempty(periods)
return "0ms"
else
return _abbstr(periods)
end
end

"""
Expand Down

0 comments on commit 0bd4667

Please sign in to comment.