X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=blobdiff_plain;f=x5%2Fkhlib_time.c;fp=x5%2Fkhatus_lib_time.c;h=c55e0af8b378cd6ae00bd728a5e80d66ab15e80a;hp=d13f689095fc6adee77b6c4f40a4eb911ec928c9;hb=1084633a90758b15f09bc5ec232c45470cdadc37;hpb=16e0239d76a7de132b20a564cc2c14ff2358ecf2 diff --git a/x5/khatus_lib_time.c b/x5/khlib_time.c similarity index 72% rename from x5/khatus_lib_time.c rename to x5/khlib_time.c index d13f689..c55e0af 100644 --- a/x5/khatus_lib_time.c +++ b/x5/khlib_time.c @@ -5,11 +5,11 @@ #include #include -#include "khatus_lib_log.h" -#include "khatus_lib_time.h" +#include "khlib_log.h" +#include "khlib_time.h" struct timespec -timespec_of_float(double n) +khlib_timespec_of_float(double n) { double integral; double fractional; @@ -23,16 +23,13 @@ timespec_of_float(double n) } void -snooze(struct timespec *t) +khlib_sleep(struct timespec *t) { struct timespec remainder; - int result; - result = nanosleep(t, &remainder); - - if (result < 0) { + if (nanosleep(t, &remainder) < 0) { if (errno == EINTR) { - warn( + khlib_warn( "nanosleep interrupted. Remainder: " "{ tv_sec = %ld, tv_nsec = %ld }", remainder.tv_sec, remainder.tv_nsec); @@ -40,7 +37,7 @@ snooze(struct timespec *t) * so not attempting to correct after an interruption. */ } else { - fatal("nanosleep: %s\n", strerror(errno)); + khlib_fatal("nanosleep: %s\n", strerror(errno)); } } }