21 |
|
|
22 |
#include <stdio.h> |
#include <stdio.h> |
23 |
#include <errno.h> |
#include <errno.h> |
|
|
|
24 |
#ifdef HAVE_STRING_H |
#ifdef HAVE_STRING_H |
25 |
#include <string.h> |
#include <string.h> |
26 |
#endif |
#endif |
|
|
|
|
#ifdef HAVE_SYS_TYPES_H |
|
|
#include <sys/types.h> |
|
|
#endif |
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H |
|
27 |
#include <netinet/in.h> |
#include <netinet/in.h> |
|
#endif |
|
|
|
|
28 |
#include <time.h> |
#include <time.h> |
29 |
|
|
30 |
#include "protocol.h" |
#include "protocol.h" |
42 |
* |
* |
43 |
* @file |
* @file |
44 |
*/ |
*/ |
45 |
int check_rdate(Port_T p) { |
int check_rdate(Socket_T s) { |
46 |
|
|
47 |
/* Offset of 00:00:00 UTC, January 1, 1970 from 00:00:00 UTC, January 1, 1900 */ |
/* Offset of 00:00:00 UTC, January 1, 1970 from 00:00:00 UTC, January 1, 1900 */ |
48 |
#define TIME_OFFSET 2208988800UL |
#define TIME_OFFSET 2208988800UL |
49 |
#define TIME_TOLERANCE (time_t)3 |
#define TIME_TOLERANCE (time_t)3 |
50 |
|
|
|
time_t systemt; |
|
|
time_t rdatet; |
|
51 |
time_t delta; |
time_t delta; |
52 |
|
time_t rdatet; |
53 |
|
time_t systemt; |
54 |
|
|
55 |
ASSERT(p); |
ASSERT(s); |
56 |
|
|
57 |
if(port_recv(p,(char*) &rdatet, sizeof(time_t), 0) <= 0) { |
if(socket_read(s,(char*) &rdatet, sizeof(time_t)) <= 0) { |
58 |
log("RDATE: error receiving data -- %s\n", STRERROR); |
log("RDATE: error receiving data -- %s\n", STRERROR); |
59 |
return FALSE; |
return FALSE; |
60 |
} |
} |