"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/osip2/osip_time.c" between
libosip2-5.2.0.tar.gz and libosip2-5.2.1.tar.gz

About: The GNU oSIP library is an implementation of SIP (RFC3261).

osip_time.c  (libosip2-5.2.0):osip_time.c  (libosip2-5.2.1)
skipping to change at line 197 skipping to change at line 197
if (t != NULL) { if (t != NULL) {
*t = now.tv_sec; *t = now.tv_sec;
} }
return now.tv_sec; return now.tv_sec;
} }
#endif #endif
void osip_compensatetime() { void osip_compensatetime() {
#ifndef ANDROID
return;
#else
static struct timeval last_now_monotonic = {0, 0}; static struct timeval last_now_monotonic = {0, 0};
static struct timeval last_now_real = {0, 0}; static struct timeval last_now_real = {0, 0};
struct timeval now_monotonic; struct timeval now_monotonic;
struct timeval now_real; struct timeval now_real;
struct timeval diff_monotonic; struct timeval diff_monotonic;
struct timeval diff_real; struct timeval diff_real;
#ifndef ANDROID
return;
#endif
_osip_gettimeofday_realtime(&now_real, NULL); _osip_gettimeofday_realtime(&now_real, NULL);
osip_gettimeofday(&now_monotonic, NULL); osip_gettimeofday(&now_monotonic, NULL);
now_monotonic.tv_sec -= offset.tv_sec; now_monotonic.tv_sec -= offset.tv_sec;
if (now_real.tv_sec == 0) if (now_real.tv_sec == 0)
return; /* no compensation */ return; /* no compensation */
/* monotonic clock may doesn't include deep sleep time */ /* monotonic clock may doesn't include deep sleep time */
/* the goal is to compensate that time by looking at the real time */ /* the goal is to compensate that time by looking at the real time */
skipping to change at line 246 skipping to change at line 245
if (diff_real.tv_sec < diff_monotonic.tv_sec + 2) if (diff_real.tv_sec < diff_monotonic.tv_sec + 2)
return; /* only large gap needs to be taken into accounts for this program.. . */ return; /* only large gap needs to be taken into accounts for this program.. . */
OSIP_TRACE(osip_trace(__FILE__, __LINE__, OSIP_WARNING, NULL, "adjusting exosi p monotonic time (%i)!\n", diff_real.tv_sec - diff_monotonic.tv_sec)); OSIP_TRACE(osip_trace(__FILE__, __LINE__, OSIP_WARNING, NULL, "adjusting exosi p monotonic time (%i)!\n", diff_real.tv_sec - diff_monotonic.tv_sec));
offset.tv_sec += diff_real.tv_sec - diff_monotonic.tv_sec; offset.tv_sec += diff_real.tv_sec - diff_monotonic.tv_sec;
/* reset for later use */ /* reset for later use */
_osip_gettimeofday_realtime(&last_now_real, NULL); _osip_gettimeofday_realtime(&last_now_real, NULL);
osip_gettimeofday(&last_now_monotonic, NULL); osip_gettimeofday(&last_now_monotonic, NULL);
last_now_monotonic.tv_sec -= offset.tv_sec; last_now_monotonic.tv_sec -= offset.tv_sec;
#endif
} }
time_t osip_getsystemtime(time_t *t) { time_t osip_getsystemtime(time_t *t) {
struct timeval now_monotonic; struct timeval now_monotonic;
#ifdef ANDROID #ifdef ANDROID
osip_compensatetime(); osip_compensatetime();
#endif #endif
osip_gettimeofday(&now_monotonic, NULL); osip_gettimeofday(&now_monotonic, NULL);
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)