sleep 3.seconds
Hard to to be more concise than that sleep 3.seconds
Hard to to be more concise than that (Time.now + 1.month).to_i == Time.now.to_i + 1.month.to_i
#=> falseThough it does seem pretty easy for a novice to do thinking it's the same, but what does 1.month.to_i even mean!?
Duration of a month in seconds? Before you balk at the idea, there exists a definition of a constant month duration for accounting stuff. I you hate dates - and yourself - try accounting, there's mind boggling stuff that makes the engineer mind recoil in absolute terror.
The expression on the left hand side advances time (as a domain object) by exactly a month, then converts the result to integer unix time. The expression on the right adds 2629746¹ to the current unix time.
The conversion becomes dangerously magical in the presence of shared code that accepts both object and integer representations of time & duration. A consumer from one part of a system can inadvertently obtain different results to another unless they use identical calling conventions.
[1] this is 1/12 of the mean length of a gregorian year²
[2] 365.2425 days i.e. 31,556,952 seconds
sleep 3