/contrib/ntp/libntp/msutotsf.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 35 lines · 22 code · 3 blank · 10 comment · 0 complexity · 0ff3f73b5fcd561988354dca77126d07 MD5 · raw file

  1. /*
  2. * msutotsf - tables for converting from a subsecond millisecond value
  3. * to a time stamp fraction.
  4. */
  5. #include <sys/types.h>
  6. #include "ntp_types.h"
  7. /*
  8. * Index each of these tables with five bits of the (less than) 10
  9. * bit millisecond value. Note that the tables are rounded (not
  10. * truncated). The error in the result will thus be +-1 low order
  11. * bit in the time stamp fraction.
  12. */
  13. u_long msutotsflo[32] = {
  14. 0x00000000, 0x00418937, 0x0083126f, 0x00c49ba6,
  15. 0x010624dd, 0x0147ae14, 0x0189374c, 0x01cac083,
  16. 0x020c49ba, 0x024dd2f2, 0x028f5c29, 0x02d0e560,
  17. 0x03126e98, 0x0353f7cf, 0x03958106, 0x03d70a3d,
  18. 0x04189375, 0x045a1cac, 0x049ba5e3, 0x04dd2f1b,
  19. 0x051eb852, 0x05604189, 0x05a1cac1, 0x05e353f8,
  20. 0x0624dd2f, 0x06666666, 0x06a7ef9e, 0x06e978d5,
  21. 0x072b020c, 0x076c8b44, 0x07ae147b, 0x07ef9db2
  22. };
  23. u_long msutotsfhi[32] = {
  24. 0x00000000, 0x083126e9, 0x10624dd3, 0x189374bc,
  25. 0x20c49ba6, 0x28f5c28f, 0x3126e979, 0x39581062,
  26. 0x4189374c, 0x49ba5e35, 0x51eb851f, 0x5a1cac08,
  27. 0x624dd2f2, 0x6a7ef9db, 0x72b020c5, 0x7ae147ae,
  28. 0x83126e98, 0x8b439581, 0x9374bc6a, 0x9ba5e354,
  29. 0xa3d70a3d, 0xac083127, 0xb4395810, 0xbc6a7efa,
  30. 0xc49ba5e3, 0xcccccccd, 0xd4fdf3b6, 0xdd2f1aa0,
  31. 0xe5604189, 0xed916873, 0xf5c28f5c, 0xfdf3b646
  32. };