File:  [DVB] / dietlibc / lib / adjtime.c
Revision 1.2: download - view: text, annotated - select for diffs
Sun Nov 4 19:03:31 2001 UTC (22 years, 7 months ago) by fefe
Branches: MAIN
CVS tags: finnland_test_200301, branch_rc14_fieldtest_finnland, branch_rc13_fieldtest_finnland, branch_rc12_fieldtest_finnland, branch_rc10_fieldtest_finnland, RELEASE_finnland_200301_1, RC12_FIELDTEST_FINNLAND, RC10_FIELDTEST_FINNLAND, HEAD
fix adjtime

#include <time.h>
#include <sys/timex.h>

int adjtime (const struct timeval *itv, struct timeval *otv) {
  struct timex tmp;
  if (itv) {
    tmp.offset = (itv->tv_usec % 1000000L) + (itv->tv_sec + itv->tv_usec / 1000000L) * 1000000L;
    tmp.modes = ADJ_OFFSET_SINGLESHOT;
  } else
    tmp.modes = 0;
  if (adjtimex(&tmp)==-1)
    return -1;
  if (otv) {
    otv->tv_usec = tmp.offset % 1000000;
    otv->tv_sec  = tmp.offset / 1000000;
  }
  return 0;
}

LinuxTV legacy CVS <linuxtv.org/cvs>