sleep rand(0.2..0.5)
Warning: Deprecated ::sleep. Use `::sleep(Time::Span)` instead
A total of 1 warnings were found.
Why we deprecated it? how to do above same functionality more easier?
AFAIK, i have to do like following:
sleep Time::Span.new(nanoseconds: (rand(0.2..0.5)*1000000000).to_u64)
I don’t even know what a nanosecond is in seconds before this change, I don’t want to count how many zeros I need to add. Why Time::Span not add support for ms
, μs
before deprecarted? or support use Number
instead of Int
when passing TimeSpan.new(*, seconds: Int)
?