1
0

clock_adjtime32.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "time32.h"
  2. #include <time.h>
  3. #include <sys/time.h>
  4. #include <sys/timex.h>
  5. #include <string.h>
  6. #include <stddef.h>
  7. struct timex32 {
  8. unsigned modes;
  9. long offset, freq, maxerror, esterror;
  10. int status;
  11. long constant, precision, tolerance;
  12. struct timeval32 time;
  13. long tick, ppsfreq, jitter;
  14. int shift;
  15. long stabil, jitcnt, calcnt, errcnt, stbcnt;
  16. int tai;
  17. int __padding[11];
  18. };
  19. int __clock_adjtime32(clockid_t clock_id, struct timex32 *tx32)
  20. {
  21. struct timex utx = {
  22. .modes = tx32->modes,
  23. .offset = tx32->offset,
  24. .freq = tx32->freq,
  25. .maxerror = tx32->maxerror,
  26. .esterror = tx32->esterror,
  27. .status = tx32->status,
  28. .constant = tx32->constant,
  29. .precision = tx32->precision,
  30. .tolerance = tx32->tolerance,
  31. .time.tv_sec = tx32->time.tv_sec,
  32. .time.tv_usec = tx32->time.tv_usec,
  33. .tick = tx32->tick,
  34. .ppsfreq = tx32->ppsfreq,
  35. .jitter = tx32->jitter,
  36. .shift = tx32->shift,
  37. .stabil = tx32->stabil,
  38. .jitcnt = tx32->jitcnt,
  39. .calcnt = tx32->calcnt,
  40. .errcnt = tx32->errcnt,
  41. .stbcnt = tx32->stbcnt,
  42. .tai = tx32->tai,
  43. };
  44. int r = clock_adjtime(clock_id, &utx);
  45. if (r<0) return r;
  46. tx32->modes = utx.modes;
  47. tx32->offset = utx.offset;
  48. tx32->freq = utx.freq;
  49. tx32->maxerror = utx.maxerror;
  50. tx32->esterror = utx.esterror;
  51. tx32->status = utx.status;
  52. tx32->constant = utx.constant;
  53. tx32->precision = utx.precision;
  54. tx32->tolerance = utx.tolerance;
  55. tx32->time.tv_sec = utx.time.tv_sec;
  56. tx32->time.tv_usec = utx.time.tv_usec;
  57. tx32->tick = utx.tick;
  58. tx32->ppsfreq = utx.ppsfreq;
  59. tx32->jitter = utx.jitter;
  60. tx32->shift = utx.shift;
  61. tx32->stabil = utx.stabil;
  62. tx32->jitcnt = utx.jitcnt;
  63. tx32->calcnt = utx.calcnt;
  64. tx32->errcnt = utx.errcnt;
  65. tx32->stbcnt = utx.stbcnt;
  66. tx32->tai = utx.tai;
  67. return r;
  68. }