Re: [hackers] [sbase][PATCH] Improvements to sleep(1):

From: Laslo Hunhold <dev_AT_frign.de>
Date: Tue, 27 Dec 2016 11:45:39 +0100

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

-- 
Laslo Hunhold <dev_AT_frign.de>
Received on Tue Dec 27 2016 - 11:45:39 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 27 2016 - 15:14:07 CET