15 gettimeofday (¤time, NULL);
16 int64_t clk = currentime.tv_sec;
18 clk += currentime.tv_usec;
26 gettimeofday (¤time, NULL);
27 int64_t clk = currentime.tv_sec;
29 clk += currentime.tv_usec;
40 int64_t currenttime_us;
44 DEBUG_DBG (
"T1: %lld, T2: %lld, T3: %lld, T4: %lld", t1, t2, t3, t4);
45 offset = ((t2 - t1) + (t3 - t4)) / 2L;
46 DEBUG_DBG (
"New offset: %lld",
offset);
50 gettimeofday (¤ttime, NULL);
51 currenttime_us = (int64_t)currenttime.tv_sec * 1000000LL + (int64_t)currenttime.tv_usec;
52 newtime_us = currenttime_us +
offset;
53 newtime.tv_sec = newtime_us / 1000000LL;
54 newtime.tv_usec = newtime_us - ((int64_t)(newtime.tv_sec) * 1000000LL);
56 settimeofday (&newtime, NULL);