/contrib/ntp/libntp/calyearstart.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 22 lines · 15 code · 3 blank · 4 comment · 0 complexity · bb422c5b43e86d17625fa1562d04ee64 MD5 · raw file

  1. /*
  2. * calyearstart - determine the NTP time at midnight of January 1 in
  3. * the year of the given date.
  4. */
  5. #include <sys/types.h>
  6. #include "ntp_types.h"
  7. #include "ntp_calendar.h"
  8. #include "ntp_stdlib.h"
  9. u_long
  10. calyearstart(u_long ntp_time)
  11. {
  12. struct calendar jt;
  13. caljulian(ntp_time,&jt);
  14. jt.yearday = 1;
  15. jt.monthday = 1;
  16. jt.month = 1;
  17. jt.hour = jt.minute = jt.second = 0;
  18. return caltontp(&jt);
  19. }