Ignore:
Timestamp:
2018-08-23T21:14:56Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Children:
f33c989e
Parents:
e2625b1a
git-author:
Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
git-committer:
Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
Message:

Get rid of sys/time.h

This commit moves the POSIX-like time functionality from libc's
sys/time.h to libposix and introduces C99-like or HelenOS-specific
interfaces to libc.

Specifically, use of sys/time.h, struct timeval, suseconds_t and
gettimeofday is replaced by time.h (C99), struct timespec (C99),
usec_t (HelenOS) and getuptime / getrealtime (HelenOS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread/fibril_synch.c

    re2625b1a r205f1add  
    3737#include <async.h>
    3838#include <adt/list.h>
    39 #include <sys/time.h>
     39#include <time.h>
    4040#include <errno.h>
    4141#include <assert.h>
     
    390390errno_t
    391391fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm,
    392     suseconds_t timeout)
     392    usec_t timeout)
    393393{
    394394        assert(fibril_mutex_is_locked(fm));
     
    400400        wdata.mutex = fm;
    401401
    402         struct timeval tv;
    403         struct timeval *expires = NULL;
     402        struct timespec ts;
     403        struct timespec *expires = NULL;
    404404        if (timeout) {
    405                 getuptime(&tv);
    406                 tv_add_diff(&tv, timeout);
    407                 expires = &tv;
     405                getuptime(&ts);
     406                ts_add_diff(&ts, USEC2NSEC(timeout));
     407                expires = &ts;
    408408        }
    409409
     
    557557 * @param arg           Argument for @a fun
    558558 */
    559 void fibril_timer_set(fibril_timer_t *timer, suseconds_t delay,
     559void fibril_timer_set(fibril_timer_t *timer, usec_t delay,
    560560    fibril_timer_fun_t fun, void *arg)
    561561{
     
    575575 * @param arg           Argument for @a fun
    576576 */
    577 void fibril_timer_set_locked(fibril_timer_t *timer, suseconds_t delay,
     577void fibril_timer_set_locked(fibril_timer_t *timer, usec_t delay,
    578578    fibril_timer_fun_t fun, void *arg)
    579579{
     
    728728}
    729729
    730 errno_t fibril_semaphore_down_timeout(fibril_semaphore_t *sem, suseconds_t timeout)
     730errno_t fibril_semaphore_down_timeout(fibril_semaphore_t *sem, usec_t timeout)
    731731{
    732732        if (timeout < 0)
     
    751751        futex_unlock(&fibril_synch_futex);
    752752
    753         struct timeval tv;
    754         struct timeval *expires = NULL;
     753        struct timespec ts;
     754        struct timespec *expires = NULL;
    755755        if (timeout) {
    756                 getuptime(&tv);
    757                 tv_add_diff(&tv, timeout);
    758                 expires = &tv;
     756                getuptime(&ts);
     757                ts_add_diff(&ts, USEC2NSEC(timeout));
     758                expires = &ts;
    759759        }
    760760
Note: See TracChangeset for help on using the changeset viewer.