Changeset daa90e8 in mainline for uspace/lib/libc/generic/async.c


Ignore:
Timestamp:
2007-07-02T18:30:54Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7b63b6b
Parents:
f2f0392
Message:

Remove duplicit and empty time.h from libc.
Move timeval functions from async.c to time.c.

File:
1 edited

Legend:

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

    rf2f0392 rdaa90e8  
    100100#include <assert.h>
    101101#include <errno.h>
    102 #include <time.h>
     102#include <sys/time.h>
    103103#include <arch/barrier.h>
    104104
     
    161161static async_client_conn_t client_connection = default_client_connection;
    162162static async_client_conn_t interrupt_received = default_interrupt_received;
    163 
    164 /** Add microseconds to give timeval */
    165 static void tv_add(struct timeval *tv, suseconds_t usecs)
    166 {
    167         tv->tv_sec += usecs / 1000000;
    168         tv->tv_usec += usecs % 1000000;
    169         if (tv->tv_usec > 1000000) {
    170                 tv->tv_sec++;
    171                 tv->tv_usec -= 1000000;
    172         }
    173 }
    174 
    175 /** Subtract 2 timevals, return microseconds difference */
    176 static suseconds_t tv_sub(struct timeval *tv1, struct timeval *tv2)
    177 {
    178         suseconds_t result;
    179 
    180         result = tv1->tv_usec - tv2->tv_usec;
    181         result += (tv1->tv_sec - tv2->tv_sec) * 1000000;
    182 
    183         return result;
    184 }
    185 
    186 /** Compare timeval
    187  *
    188  * @return 1 if tv1 > tv2, otherwise 0
    189  */
    190 static int tv_gt(struct timeval *tv1, struct timeval *tv2)
    191 {
    192         if (tv1->tv_sec > tv2->tv_sec)
    193                 return 1;
    194         if (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec > tv2->tv_usec)
    195                 return 1;
    196         return 0;
    197 }
    198 static int tv_gteq(struct timeval *tv1, struct timeval *tv2)
    199 {
    200         if (tv1->tv_sec > tv2->tv_sec)
    201                 return 1;
    202         if (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec >= tv2->tv_usec)
    203                 return 1;
    204         return 0;
    205 }
    206163
    207164/* Hash table functions */
Note: See TracChangeset for help on using the changeset viewer.