rtime(3) Library Functions Manual rtime(3) rtime - (libc -lc) #include int rtime(struct sockaddr_in *addrp, struct rpc_timeval *timep, struct rpc_timeval *timeout); RFC 868 . 00:00:00 UTC 1 1900 1970-01-01 00:00:00 +0000 (UTC). timeout NULL udp/time ( 37). tcp/time ( 37). 0 32- timep->tv_sec. -1 errno . (sendto(2) poll(2) recvfrom(2) connect(2) read(2)). : EIO 4. ETIMEDOUT timeout. attributes(7). +------------+------------------------------------+--------------------+ || | | +------------+------------------------------------+--------------------+ |rtime() | | MT-Safe | +------------+------------------------------------+--------------------+ IPv4 . in.timed TCP . use_tcp 1. rtime() glibc 2.2.5 64-. 37 . /etc/inetd.conf . "linux". "localhost". "linux". #include #include #include #include #include #include #include static int use_tcp = 0; static const char servername[] = "linux"; int main(void) { int ret; time_t t; struct hostent *hent; struct rpc_timeval time1 = {0, 0}; struct rpc_timeval timeout = {1, 0}; struct sockaddr_in name; memset(&name, 0, sizeof(name)); sethostent(1); hent = gethostbyname(servername); memcpy(&name.sin_addr, hent->h_addr, hent->h_length); ret = rtime(&name, &time1, use_tcp ? NULL : &timeout); if (ret < 0) perror("rtime error"); else { t = time1.tv_sec; printf("%s\n", ctime(&t)); } exit(EXIT_SUCCESS); } ntpdate(1), inetd(8) 3 . . : . 6.18 8 2026 rtime(3)