Delay, sleep and sleep until (countdown timer) functions

preview_player
Показать описание
delay [1] is basically a combination of sleep(1) and sleep until [date string] with many output formatting `-c` and a big text `-C`, plus preset formats:

`-q`: quiet output
`-m`: minimal output
`-d`: default output
`-v`: verbose output

You can also adjust updating interval `-u` if you don't want delay refresh once a second; a command for execution upon the time-up.

It has same sleep(1) suffixes like `s`, `m`, etc; and similar date string format as in date(1). You can specify by descriptive text or date/time tags. However its timespec isn't very flexible as date(1), you may want to read delay(1) first.

I have actually done the similar tasks with two of my codes, one is urtimer (Python) [2], another is sleeptil (Sleep Until) (Bash) [3]. But I like this C program, even they are not completely all the same, "Delay attempts to compensate for the time it spends printing the updates."

This video is like running

$ delay until 00:00 27 feb 2014
$ delay until now + 3650 days

Well, only a decade plus a couple of years late.

----

For error:

delay.c:380:3: error: 'exit' undeclared (first use in this function)

Add the following to delay.c, replace [] with angle brackets:

#include [stdlib.h]

----

* Version 1.6 (2002-02-09)
* In C
* By Tom Rothamel
* GPLv2

Рекомендации по теме