diff --git a/examples/C/zhelpers.h b/examples/C/zhelpers.h index 12cee3570..66635768d 100644 --- a/examples/C/zhelpers.h +++ b/examples/C/zhelpers.h @@ -180,9 +180,10 @@ s_sleep (int msecs) Sleep (msecs); #else struct timespec t; - t.tv_sec = msecs / 1000; - t.tv_nsec = msecs * 1000000; - nanosleep (&t, NULL); + t.tv_sec = msecs / 1000; + t.tv_nsec = (msecs % 1000) * 1000000; + int rc = nanosleep (&t, NULL); + assert (rc == 0); #endif }