Changeset bd41ac52 in mainline for uspace/lib/c/generic/async/server.c


Ignore:
Timestamp:
2018-08-25T22:21:25Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cca80a2
Parents:
e2625b1a
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 C11-like or HelenOS-specific
interfaces to libc.

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

Also attempt to fix the implementation of clock() to return microseconds
(clocks) rather than processor cycles and move it to libc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async/server.c

    re2625b1a rbd41ac52  
    110110#include <assert.h>
    111111#include <errno.h>
    112 #include <sys/time.h>
     112#include <time.h>
    113113#include <stdbool.h>
    114114#include <stdlib.h>
     
    916916 *
    917917 */
    918 bool async_get_call_timeout(ipc_call_t *call, suseconds_t usecs)
     918bool async_get_call_timeout(ipc_call_t *call, usec_t usecs)
    919919{
    920920        assert(call);
    921921        assert(fibril_connection);
    922922
    923         struct timeval tv;
    924         struct timeval *expires = NULL;
     923        struct timespec ts;
     924        struct timespec *expires = NULL;
    925925        if (usecs) {
    926                 getuptime(&tv);
    927                 tv_add_diff(&tv, usecs);
    928                 expires = &tv;
     926                getuptime(&ts);
     927                ts_add_diff(&ts, USEC2NSEC(usecs));
     928                expires = &ts;
    929929        }
    930930
Note: See TracChangeset for help on using the changeset viewer.