.\"
.\" Slightly polished, aeb, 2003-04-06
.\"
-.TH RTIME 3 2012-08-03 "GNU" "Linux Programmer's Manual"
+.TH RTIME 3 2014-05-28 "GNU" "Linux Programmer's Manual"
.SH NAME
rtime \- get time from a remote machine
.SH SYNOPSIS
.nf
-.B "#include <rpc/des_crypt.h>"
+.B "#include <rpc/auth_des.h>"
.sp
.BI "int rtime(struct sockaddr_in *" addrp ", struct rpc_timeval *" timep ,
.BI " struct rpc_timeval *" timeout );
.TP
.B ETIMEDOUT
The waiting time as defined in timeout has expired.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR rtime ()
+function is thread-safe.
.SH NOTES
Only IPv4 is supported.
.LP
Some
.I in.timed
-versions only support TCP.
+versions support only TCP.
Try the example program with
.I use_tcp
set to 1.
.LP
Libc5 uses the prototype
-.br
-int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
-.br
+.nf
+
+ int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
+
+.fi
and requires
.I <sys/time.h>
instead of
that the time entry within
.I /etc/inetd.conf
is not commented out.
-.br
+
The program connects to a computer called "linux".
Using "localhost" does not work.
The result is the localtime of the computer "linux".
#include <rpc/auth_des.h>
#include <netdb.h>
-int use_tcp = 0;
-char *servername = "linux";
+static int use_tcp = 0;
+static char *servername = "linux";
int
main(void)
if (ret < 0)
perror("rtime error");
else {
- time_t t = time1.tv_sec;
+ time_t t = time1.tv_sec;
printf("%s\\n", ctime(&t));
}
.BR ntpdate (1),
.\" .BR rdate (1),
.BR inetd (8)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.