Lines Matching +full:tv +full:- +full:set
45 #include "un-namespace.h"
68 * from internet time-service time, into UNIX time we subtract the
71 #define NYEARS (1970 - 1900)
93 sin->sin_addr.s_addr |= (a[i] & 0x000000FF) << (8 * i); in uaddr_to_sockaddr()
98 sin->sin_family = AF_INET; /* always */ in uaddr_to_sockaddr()
99 bcopy((char *)&p_bytes, (char *)&sin->sin_port, 2); in uaddr_to_sockaddr()
133 * host - name of the time host
134 * srv - nis_server struct to use.
135 * eps[] - array of endpoints
136 * maxep - max array size
158 ptr[0] = (char *)&sin->sin_addr.s_addr; in get_server()
167 for (i = 0, ep = eps; (he->h_addr_list[i] != NULL) && (num_ep < maxep); in get_server()
171 a = (struct in_addr *)he->h_addr_list[i]; in get_server()
173 ep->uaddr = strdup(hname); in get_server()
174 ep->family = strdup("inet"); in get_server()
175 ep->proto = strdup("tcp"); in get_server()
176 if (ep->uaddr == NULL || ep->family == NULL || ep->proto == NULL) { in get_server()
182 for (i = 0; (he->h_addr_list[i] != NULL) && (num_ep < maxep); in get_server()
186 a = (struct in_addr *)he->h_addr_list[i]; in get_server()
188 ep->uaddr = strdup(hname); in get_server()
189 ep->family = strdup("inet"); in get_server()
190 ep->proto = strdup("udp"); in get_server()
191 if (ep->uaddr == NULL || ep->family == NULL || ep->proto == NULL) { in get_server()
197 srv->name = (nis_name) host; in get_server()
198 srv->ep.ep_len = num_ep; in get_server()
199 srv->ep.ep_val = eps; in get_server()
200 srv->key_type = NIS_PK_NONE; in get_server()
201 srv->pkey.n_bytes = NULL; in get_server()
202 srv->pkey.n_len = 0; in get_server()
220 * Once through, *uaddr is set to the universal address of
221 * the machine and *netid is set to the local netid for the transport
226 * td = "server" - "client"
228 * td - Time difference
229 * srv - NIS Server description
230 * thost - if no server, this is the timehost
231 * uaddr - known universal address
232 * netid - known network identifier
246 struct timeval tv; in __rpc_get_time_offset() local
248 int udp_ep = -1, tcp_ep = -1; in __rpc_get_time_offset()
259 td->tv_sec = 0; in __rpc_get_time_offset()
260 td->tv_usec = 0; in __rpc_get_time_offset()
280 ep = srv->ep.ep_val; in __rpc_get_time_offset()
281 epl = srv->ep.ep_len; in __rpc_get_time_offset()
285 (i < epl) && ((udp_ep == -1) || (tcp_ep == -1)); i++) { in __rpc_get_time_offset()
293 if (tcp_ep > -1) { in __rpc_get_time_offset()
297 } else if (udp_ep > -1) { in __rpc_get_time_offset()
345 tv.tv_sec = 5; in __rpc_get_time_offset()
346 tv.tv_usec = 0; in __rpc_get_time_offset()
349 (xdrproc_t)xdr_u_long, &thetime, tv); in __rpc_get_time_offset()
383 if (s == -1) { in __rpc_get_time_offset()
390 * UDP we set a timeout or not. in __rpc_get_time_offset()
399 (struct sockaddr *)&sin, sizeof(sin)) == -1) { in __rpc_get_time_offset()
414 if (res == -1) { in __rpc_get_time_offset()
426 if (res == -1) { in __rpc_get_time_offset()
452 thetime = thetime - TOFFSET; /* adjust to UNIX time */ in __rpc_get_time_offset()
457 gettimeofday(&tv, 0); in __rpc_get_time_offset()
484 tv.tv_sec += (tv.tv_sec > 500000) ? 1 : 0; in __rpc_get_time_offset()
485 delta = (thetime > tv.tv_sec) ? thetime - tv.tv_sec : in __rpc_get_time_offset()
486 tv.tv_sec - thetime; in __rpc_get_time_offset()
487 td->tv_sec = (thetime < tv.tv_sec) ? - delta : delta; in __rpc_get_time_offset()
488 td->tv_usec = 0; in __rpc_get_time_offset()