Here is a trial run, first with the signal-safe write(2) method:
$ ./intv_clksimpleUsage: ./intv_clksimple {0|1} 0 : the Correct way (using write(2) in the signal handler) 1 : the *Wrong* way (using printf(3) in the signal handler) *@your risk*$ ./intv_clksimple 0Thu Jun 28 17:52:38 2018Thu Jun 28 17:52:39 2018Thu Jun 28 17:52:40 2018Thu Jun 28 17:52:41 2018Thu Jun 28 17:52:42 2018^C$
And now, here's one with the signal-unsafe printf(3)/fflush(3) method:
$ ./intv_clksimple 1 *WARNING* [Using printf in signal handler]Thu Jun 28 17:54:53 2018^C$
It looks nicer, what with the timestamp being continually refreshed on the same line, but is unsafe. This book cannot show you, dear reader, the pleasant effect of the carriage return- ...