Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2013 11:48:32 +0200
From:      Jens Schweikhardt <schweikh@schweikhardt.net>
To:        Kenta Suzumoto <kentas@hush.com>
Cc:        freebsd-current@freebsd.org, freebsd-questions@freebsd.org
Subject:   Re: BSD sleep
Message-ID:  <20130530094832.GB3053@schweikhardt.net>
In-Reply-To: <20130528230140.A5B396F448@smtp.hushmail.com>
References:  <20130528230140.A5B396F448@smtp.hushmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 28, 2013 at 07:01:40PM -0400, Kenta Suzumoto wrote:
# Hi. Is there no built-in way of making "sleep" sleep in increments 
# of minutes, hours, etc? The GNU "sleep" can be invoked like "sleep 
# 1h" for an hour. The FreeBSD one's manpage leads me to believe we 
# can only use seconds, which is kind of annoying. Is there an 
# undocmented or missing feature here? Seems really trivial to 
# implement.
# 
# ~ $ sleep 1h
# usage: sleep seconds

Perfection is reached when there is nothing left to take away. The GNU
format is already an incompatibility. If I want to sleep longer than 3
digit amount in secs, I do the math. The POSIXly *portable* way to do
this and document it for the mathematically challenged is

    sleep $((2*60*60))    # 2h
    sleep $((7*24*60*60)) # 1w

Regards,

	Jens
-- 
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130530094832.GB3053>