platform.h: added to repository

Allows for quick and dirty platform detection.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime: add Windows support

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
hz: adding work rate-limiting test

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime: make libtime_cpu() compile under Visual C++

Completely untested, but looks right based on documentation...

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
hz: improve precision of rate limiting

By estimating the minimum sleep time clock_nanosleep() will use up, we can
determine whether or not sleeping will take us past our desired quantum. If we
are too close to the quantum for a clock_nanosleep() to work well for us, then
we can just spin reading the CPU clock until time runs out.

For the most part, this should still be efficient, because it will sleep for
the majority of the spare time.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime.h: remove unnecessary include, add header guard

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
libtime: add libtime_nanosleep function for high-precision sleeps

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