On Tue, 27 Dec 2016 11:45:39 +0100
Laslo Hunhold <dev_AT_frign.de> wrote:
> On Sat, 26 Mar 2016 18:31:57 +0100
> Mattias Andrée <maandree_AT_kth.se> wrote:
>
> Hey Mattias,
>
> > - Add support for floating pointer numbers,
> > which you will find in other implementations.
>
> I do not favor this aspect, as Dimitris already
> established well.
>
> > - Add support for suffixes [s|m|h|d], as
> > found in GNU sleep, which is very useful.
>
> This is the only thing I could remotely live with, but
> this would require us to hand-fiddle with strtod() and
> have a "lookup-table" for residuums and multiplication
> factors (in seconds), e.g.
>
> "s" -> 1
> "m" -> 60
> "h" -> 60 * 60
> "d" -> 24 * 60 * 60
>
> and then do a
>
> for (... i ...) {
> if (strcmp(endptr, lookuptable[i].str)) {
> sleeptime *= lookuptable[i].fac
> }
> }
>
> However, anything involving longer "waiting" times than 1
> hour should be done with cron(1). I assume that a naïve
> programmer would get the idea of having a rc-script that
> just idles for 24 hours in an infinite loop, and having
> flags in sleep encouraging this is not helpful to break
> this premise.
>
> > - Add support for multiple arguments. Not
> > really necessary, but brings compatibility
> > at barely any cost.
>
> What is the purpose of this aspect?
>
> Cheers
>
> Laslo
>
I have withdrawn this proposal.
But the idea of having multiple arguments is that you
can write for example “1h 30m”, of course, this is not
important is you can just as well write “90m”, and in
case where the calculations are that simple you can
use expr(1), but implementing it didn't really complicate
anything and brings compatibility.
Waits shorted that 1s is useful in things like rc-scripts
that need to wait for a short period. And longer waits
are useful in cases like if you are setting up a simple
alarm if you want to take a short rest, or if you have
a lot of things running in different terminals (because
you want to see the output of each) but you don't want
all of the to run a the same time.
Received on Tue Dec 27 2016 - 15:45:00 CET