Skip to content

Commit

Permalink
types.jl: sleep with Date.Period types
Browse files Browse the repository at this point in the history
Supports sleep(Dates.Second(10))
		 sleep(Dates.Milliesecond(10))

Closes #19736
  • Loading branch information
Shade5 committed Dec 29, 2016
1 parent 07b7a7f commit 3d43a79
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/dates/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,8 @@ Base.isless(x::Date,y::Date) = isless(value(x),value(y))
Base.isless(x::DateTime,y::DateTime) = isless(value(x),value(y))
Base.isless(x::TimeType,y::TimeType) = isless(promote(x,y)...)
==(x::TimeType,y::TimeType) = ===(promote(x,y)...)

import Base: sleep,Timer,timedwait
sleep(time::Dates.Period) = sleep(Dates.toms(time) / 1000)
Timer(time::Dates.Period, repeat::Dates.Period=0.0) = Timer(Dates.toms(time) / 1000,Dates.toms(repeat) / 1000)
timedwait(testcb::Function, time::Dates.Period, pollint::Float64) = timedwait(testcb, Dates.toms(time) / 1000, pollint)

0 comments on commit 3d43a79

Please sign in to comment.