.\"
.\" Slightly polished, aeb, 2003-04-06
.\"
-.TH RTIME 3 2012-08-03 "GNU" "Linux Programmer's Manual"
+.TH RTIME 3 2014-01-05 "GNU" "Linux Programmer's Manual"
.SH NAME
rtime \- get time from a remote machine
.SH SYNOPSIS
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));
}