libtime.c: fix Windows sleep behavior

On Windows, Sleep(0) has special meaning, and is basically the equivalent of
thread_yield(). We don't want to yield the thread, but instead sleep for the
minimum amount of time possible.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime.c: instead of measuring minimum Sleep() time, measure maximum

We really want the worst-case observed time so we can avoid overshooting the
target.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime.c: do variable-length testing of system sleep call

If the system sleep takes a long time (e.g. Windows), then doing too many
samples will cause libtime_init() to take a long time.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime.c: be consistent about indentation

Signed-off-by: Steven Noonan <steven@uplinklabs.net>