#include "time32.h" #include #include #include #include #include struct oldtimex { unsigned modes; long offset, freq, maxerror, esterror; int status; long constant, precision, tolerance; long time_sec, time_usec; long tick, ppsfreq, jitter; int shift; long stabil, jitcnt, calcnt, errcnt, stbcnt; int tai; int __padding[11]; }; int __adjtimex_time32(struct timex *tx32) { struct timex utx; memcpy(&utx, tx32, sizeof(struct oldtimex)); utx.time.tv_sec = *(long *)((char *)tx32 + offsetof(struct oldtimex,time_sec)); utx.time.tv_usec = *(long *)((char *)tx32 + offsetof(struct oldtimex,time_usec)); int r = adjtimex(&utx); if (r<0) return r; memcpy(tx32, &utx, sizeof(struct oldtimex)); *(long *)((char *)tx32 + offsetof(struct oldtimex,time_sec)) = utx.time.tv_sec; *(long *)((char *)tx32 + offsetof(struct oldtimex,time_usec)) = utx.time.tv_usec; return r; }