strftime.c: implement %N format specifier with extra semantics
The '%N' format specifier is implemented to insert the 9-digit
nanoseconds value (which will always be all zeros unless the current
time is used).
Since the gettimeofday() function only provides microseconds, the
last three digits of the %N value will always be zero anyway.
To assist with generating unique names, the "extra semantics" are
that whenever %N is used together with current time then a 1 ms
sleep will be performed before and after the call to the gettimeofday()
function. This provides a guarantee to the caller (excluding the
possibility of any clock resets) that combining the pid with the
timestamp will produce a unique value that will not be generated
by any other process on the system either before or after the call.
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>