1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
.\" Copyright 2003 walter harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" Modified 2003-04-04 Walter Harms
.\" <walter.harms@informatik.uni-oldenburg.de>
.\"
.\" Slightly polished, aeb, 2003-04-06
.\"
.\" Japanese Version Copyright (c) 2004 Yuichi SATO
.\" all rights reserved.
.\" Translated Thu Sep 2 07:40:48 JST 2004
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.TH RTIME 3 2003-04-04 "sunrpc" "RPC time function"
.SH ̾
rtime \- ⡼ȥޥ
.SH
.sp
.B "#include <rpc/des_crypt.h>"
.sp
.BI "int rtime(struct sockaddr_in *" addrp ,
.BI "struct rpc_timeval *" timep ,
.BI "struct rpc_timeval *" timeout );
.sp
.SH
δؿ RFC 868 ˵ҤƤ륿ॵХץȥѤ
⡼ȥޥ롣
.LP
ॵХץȥ 1900-01-01 θ 0 ÿΤǡ
δؿŬڤͤȤˤꡢ
줿ͤ 1970-01-01 θ 0 (Unix ε) ÿѴ롣
.LP
.I timeout
NULL Ǥʤ硢udp/time å (ݡ 37) Ѥ롣
ʳξ硢tcp/time å (ݡ 37) Ѥ롣
.SH ֤
ϡ0 ֤ơ줿 32 ӥåȤλͤ
.I timep->tv_sec
˳Ǽ롣
顼ξϡ-1 ֤ơ
.I errno
Ŭڤꤵ롣
.SH 顼
ǻѤƤؿ (sendto, poll, recvfrom, connect, read)
ƤΥ顼ǽ롣
˼Υ顼ǽ:
.TP
.B EIO
֤줿Хȿ 4 ХȤǤʤ
.TP
.B ETIMEDOUT
timeout 줿Ԥ֤δ¤ڤ줿
.SH
Ǥϥݡ 37 åפƥץƤɬפ롣
.I /etc/inetd.conf
time ȥ꤬ȥȤƤʤȤǧƤۤ
.br
Υץ 'linux' Ȥԥ塼³롣
\&'localhost' Ȥäưʤ
̤ϥԥ塼 'linux' ΥǤ롣
.sp
.nf
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <rpc/auth_des.h>
#include <netdb.h>
int use_tcp = 0;
char *servername = "linux";
int main() {
struct sockaddr_in name;
struct rpc_timeval time1 = {0,0};
struct rpc_timeval timeout = {1,0};
struct hostent *hent;
int ret;
memset((char *)&name, 0, sizeof(name));
sethostent(1);
hent = gethostbyname(servername);
memcpy((char *)&name.sin_addr, hent->h_addr, hent->h_length);
ret = rtime(&name, &time1, use_tcp ? NULL : &timeout);
if (ret < 0)
perror("rtime error");
else
printf("%s", ctime((time_t *)&time1.tv_sec));
return 0;
}
.fi
.SH
IPv4 ΤߤݡȤƤ롣
.LP
.I in.timed
ΥСˤäƤ TCP ݡȤƤʤΤ⤢롣
.I use_tcp
1 ꤷơˤץȡ
.LP
libc5 ϥץȥ
.br
int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
.br
Ȥ
.I <rpc/auth_des.h>
.I <sys/time.h>
ɬפȤ롣
.SH Х
glibc 2.2.5 rtime() ϡ64 ӥåȥޥΤưʤ
.SH Ϣ
.BR netdate (1),
.BR ntpdate (1),
.BR rdate (1),
.BR inetd (8)
|