1RTIME(3) BSD Library Functions Manual RTIME(3)
2
4 rtime — get remote time
5
7 Standard C Library (libc, -lc)
8
10 #include <sys/types.h>
11 #include <sys/time.h>
12 #include <netinet/in.h>
13
14 int
15 rtime(struct sockaddr_in *addrp, struct timeval *timep,
16 struct timeval *timeout);
17
19 The rtime() function consults the Internet Time Server at the address
20 pointed to by addrp and returns the remote time in the timeval struct
21 pointed to by timep. Normally, the UDP protocol is used when consulting
22 the Time Server. The timeout argument specifies how long the routine
23 should wait before giving up when waiting for a reply. If timeout is
24 specified as NULL, however, the routine will instead use TCP and block
25 until a reply is received from the time server.
26
28 The rtime() function returns the value 0 if successful; otherwise the
29 value -1 is returned and the global variable errno is set to indicate the
30 error.
31
33 timed(8)
34
35BSD November 22, 1987 BSD