[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH 1/1] Implement usleep
Hi Vlad, Thanks for the patch, it looks good. In the future this should be moved to Unikraft's uinstd library, but for now: Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx> On 30.05.19, 13:38, "Vlad-Andrei BĂDOIU (78692)" <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> wrote: Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> --- time.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/time.c b/time.c index dccf8a1..94e8097 100644 --- a/time.c +++ b/time.c @@ -113,6 +113,18 @@ int nanosleep(const struct timespec *req, struct timespec *rem) return 0; } +int usleep(useconds_t usec) +{ + struct timespec ts; + + ts.tv_sec = (long int) (usec / 1000000); + ts.tv_nsec = (long int) ukarch_time_usec_to_nsec(usec % 1000000); + if (nanosleep(&ts, &ts)) + return -1; + + return 0; +} + unsigned int sleep(unsigned int seconds) { struct timespec ts; -- 2.21.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |