Changeset 3448:a1d933fa1897 in roaraudio for libroarpulse/timeval.c


Ignore:
Timestamp:
02/13/10 15:58:10 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

implemented pa_timeval_add()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/timeval.c

    r3447 r3448  
    5454int pa_timeval_cmp(const struct timeval *a, const struct timeval *b); 
    5555pa_usec_t pa_timeval_age(const struct timeval *tv); 
    56 struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v); 
     56struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v) { 
     57 unsigned long long int secs; 
     58 
     59 if ( tv == NULL ) 
     60  return NULL; 
     61 
     62 secs = v/1000000LLU; 
     63 
     64 tv->tv_sec += secs; 
     65 
     66 v -= secs*1000000LLU; 
     67 
     68 tv->tv_usec += v; 
     69 
     70 while ( tv->tv_usec > 1000000LLU ) { 
     71  tv->tv_usec -= 1000000LLU; 
     72  tv->tv_sec  += 1; 
     73 } 
     74 
     75 return tv; 
     76} 
    5777 
    5878 
Note: See TracChangeset for help on using the changeset viewer.