Index: uspace/lib/c/generic/thread/fibril.c
===================================================================
--- uspace/lib/c/generic/thread/fibril.c	(revision f787c8e603e6091f428e7d4b79342b95a4fc26f4)
+++ uspace/lib/c/generic/thread/fibril.c	(revision 8867cf60014e9288ad97cf5fd5d82bcd6e605782)
@@ -60,5 +60,5 @@
 typedef struct {
 	link_t link;
-	struct timeval expires;
+	struct timespec expires;
 	fibril_event_t *event;
 } _timeout_t;
@@ -142,5 +142,5 @@
 }
 
-static inline errno_t _ready_down(const struct timeval *expires)
+static inline errno_t _ready_down(const struct timespec *expires)
 {
 	if (multithreaded)
@@ -253,5 +253,5 @@
 }
 
-static errno_t _ipc_wait(ipc_call_t *call, const struct timeval *expires)
+static errno_t _ipc_wait(ipc_call_t *call, const struct timespec *expires)
 {
 	if (!expires)
@@ -261,11 +261,12 @@
 		return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING);
 
-	struct timeval now;
+	struct timespec now;
 	getuptime(&now);
 
-	if (tv_gteq(&now, expires))
+	if (ts_gteq(&now, expires))
 		return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING);
 
-	return ipc_wait(call, tv_sub_diff(expires, &now), SYNCH_FLAGS_NONE);
+	return ipc_wait(call, NSEC2USEC(ts_sub_diff(expires, &now)),
+	    SYNCH_FLAGS_NONE);
 }
 
@@ -275,5 +276,5 @@
  * wait after new ready fibrils are added.
  */
-static fibril_t *_ready_list_pop(const struct timeval *expires, bool locked)
+static fibril_t *_ready_list_pop(const struct timespec *expires, bool locked)
 {
 	if (locked) {
@@ -370,5 +371,5 @@
 static fibril_t *_ready_list_pop_nonblocking(bool locked)
 {
-	struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
+	struct timespec tv = { .tv_sec = 0, .tv_nsec = 0 };
 	return _ready_list_pop(&tv, locked);
 }
@@ -393,5 +394,5 @@
 
 /* Blocks the current fibril until an IPC call arrives. */
-static errno_t _wait_ipc(ipc_call_t *call, const struct timeval *expires)
+static errno_t _wait_ipc(ipc_call_t *call, const struct timespec *expires)
 {
 	futex_assert_is_not_locked(&fibril_futex);
@@ -430,8 +431,8 @@
 
 /** Fire all timeouts that expired. */
-static struct timeval *_handle_expired_timeouts(struct timeval *next_timeout)
-{
-	struct timeval tv;
-	getuptime(&tv);
+static struct timespec *_handle_expired_timeouts(struct timespec *next_timeout)
+{
+	struct timespec ts;
+	getuptime(&ts);
 
 	futex_lock(&fibril_futex);
@@ -441,5 +442,5 @@
 		_timeout_t *to = list_get_instance(cur, _timeout_t, link);
 
-		if (tv_gt(&to->expires, &tv)) {
+		if (ts_gt(&to->expires, &ts)) {
 			*next_timeout = to->expires;
 			futex_unlock(&fibril_futex);
@@ -535,7 +536,7 @@
 	(void) arg;
 
-	struct timeval next_timeout;
+	struct timespec next_timeout;
 	while (true) {
-		struct timeval *to = _handle_expired_timeouts(&next_timeout);
+		struct timespec *to = _handle_expired_timeouts(&next_timeout);
 		fibril_t *f = _ready_list_pop(to, false);
 		if (f) {
@@ -615,5 +616,5 @@
 		_timeout_t *cur = list_get_instance(tmp, _timeout_t, link);
 
-		if (tv_gteq(&cur->expires, &timeout->expires))
+		if (ts_gteq(&cur->expires, &timeout->expires))
 			break;
 
@@ -634,5 +635,6 @@
  * @return ETIMEOUT if timed out. EOK otherwise.
  */
-errno_t fibril_wait_timeout(fibril_event_t *event, const struct timeval *expires)
+errno_t fibril_wait_timeout(fibril_event_t *event,
+    const struct timespec *expires)
 {
 	assert(fibril_self()->rmutex_locks == 0);
@@ -889,9 +891,9 @@
 }
 
-void fibril_usleep(suseconds_t timeout)
-{
-	struct timeval expires;
+void fibril_usleep(usec_t timeout)
+{
+	struct timespec expires;
 	getuptime(&expires);
-	tv_add_diff(&expires, timeout);
+	ts_add_diff(&expires, USEC2NSEC(timeout));
 
 	fibril_event_t event = FIBRIL_EVENT_INIT;
@@ -899,7 +901,7 @@
 }
 
-void fibril_sleep(unsigned int sec)
-{
-	struct timeval expires;
+void fibril_sleep(sec_t sec)
+{
+	struct timespec expires;
 	getuptime(&expires);
 	expires.tv_sec += sec;
@@ -916,5 +918,5 @@
 }
 
-errno_t fibril_ipc_wait(ipc_call_t *call, const struct timeval *expires)
+errno_t fibril_ipc_wait(ipc_call_t *call, const struct timespec *expires)
 {
 	return _wait_ipc(call, expires);
