1 /* $NetBSD: buftvtots.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */
4 * buftvtots - pull a Unix-format (struct timeval) time stamp out of
5 * an octet stream and convert it to a l_fp time stamp.
6 * This is useful when using the clock line discipline.
13 #include "ntp_string.h"
14 #include "ntp_unixtime.h"
25 * copy to adhere to alignment restrictions
27 memcpy(&tv
, bufp
, sizeof(tv
));
32 ts
->l_ui
= tv
.tv_sec
+ (u_long
)JAN_1970
;
33 if (tv
.tv_usec
> 999999)
35 TVUTOTSF(tv
.tv_usec
, ts
->l_uf
);