[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/NEWLIB PATCH 1/1] Implement usleep



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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.