11 #define __BSD_VISIBLE 1 12 #include <sys/types.h> 13 #include <sys/socket.h> 15 #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE 20 #include <sys/types.h> 21 #include <sys/socket.h> 22 #include <netinet/in.h> 23 #include <rtems/rtems_bsdnet_internal.h> 34 static int ntpSocket = -1;
47 static unsigned bequiet;
62 ret = recvfrom(ntpSocket, junk,
sizeof(junk), MSG_DONTWAIT,
NULL,
NULL);
63 if (ret == -1 && errno == EAGAIN) {
68 printf(
"osdNTPGet cleaner error: %s\n", strerror(errno));
83 struct sockaddr_in myAddr;
85 ntpSocket = socket (AF_INET, SOCK_DGRAM, 0);
87 printf(
"osdNTPInit() Can't create socket: %s\n", strerror (errno));
90 memset (&myAddr, 0,
sizeof myAddr);
91 myAddr.sin_family = AF_INET;
92 myAddr.sin_port = htons (0);
93 myAddr.sin_addr.s_addr = htonl (INADDR_ANY);
94 if (bind (ntpSocket, (
struct sockaddr *)&myAddr,
sizeof myAddr) < 0) {
95 printf(
"osdNTPInit() Can't bind socket: %s\n", strerror (errno));
108 rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &t);
122 struct tm * pRet = gmtime_r ( pAnsiTime, pTM );
133 struct tm * pRet = localtime_r ( clock, result );
156 static int staticTimeRegister(
void)
166 if (rtems_bsdnet_ticks_per_second != 0)
171 static int done = staticTimeRegister();
int osdNTPGet(struct timespec *ts)
void ClockTime_Init(int synchronize)
double rtemsTicksPerTwoSeconds_double
void osdMonotonicInit(void)
#define epicsTimeOK
Success.
void osdTimeRegister(void)
void NTPTime_Init(int priority)
int rtems_bsdnet_get_ntp(int, int(*)(), struct timespec *)
double rtemsTicksPerSecond_double
Defined by POSIX Real Time.
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
int epicsTime_gmtime(const time_t *pAnsiTime, struct tm *pTM)
Break down a time_t into a struct tm in the UTC timezone.
int epicsTime_localtime(const time_t *clock, struct tm *result)
Break down a time_t into a struct tm in the local timezone.
rtems_interval rtemsTicksPerSecond