#include <vxWorks.h>
#include <sntpcLib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <taskLib.h>
#include "epicsTime.h"
#include "osiNTPTime.h"
#include "osiClockTime.h"
#include "generalTimeSup.h"
#include "envDefs.h"
Go to the source code of this file.
#define _VSB_CONFIG_FILE <../lib/h/config/vsbConfig.h> |
#define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE |
#define NTP_REQUEST_TIMEOUT 4 /* seconds */ |
int epicsTime_gmtime |
( |
const time_t * |
pAnsiTime, |
|
|
struct tm * |
pTM |
|
) |
| |
Break down a time_t
into a struct tm
in the UTC timezone.
Definition at line 130 of file osdTime.cpp.
132 gmtime_r(pAnsiTime, pTM);
#define epicsTimeOK
Success.
int epicsTime_localtime |
( |
const time_t * |
clock, |
|
|
struct tm * |
result |
|
) |
| |
Break down a time_t
into a struct tm
in the local timezone.
Definition at line 122 of file osdTime.cpp.
124 localtime_r(clock,
result);
#define epicsTimeOK
Success.
Definition at line 91 of file osdTime.cpp.
93 return sntpcTimeGet(const_cast<char *>(pserverAddr),
#define NTP_REQUEST_TIMEOUT
Definition at line 97 of file osdTime.cpp.
101 BOOT_PARAMS bootParms;
102 static char host_addr[BOOT_ADDR_LEN];
106 strncpy(host_addr, bootParms.had, BOOT_ADDR_LEN);
107 pserverAddr = host_addr;
LIBCOM_API const char *epicsStdCall envGetConfigParamPtr(const ENV_PARAM *pParam)
Get a configuration parameter's value or default string.
LIBCOM_API const ENV_PARAM EPICS_TS_NTP_INET
void osdNTPReport |
( |
void |
| ) |
|
Definition at line 158 of file tz2timezone.c.
160 const char *tz = getenv(
"TZ");
167 char start[10], stop[10];
168 int hours = 0, minutes = 0, sign = 1;
187 if ((!tz) || (strlen(tz) < 3))
196 while ((i <
sizeof(zone) - 1) && isalpha((
int) *tz)) {
211 else if (*tz ==
'+') {
216 if (!isdigit((
int) *tz))
220 tz = getTime(tz, &hours);
226 if (!isdigit((
int) *++tz))
230 tz = getTime(tz, &minutes);
237 tz = getTime(tz + 1, &seconds);
242 if (isalpha((
int) *tz)) {
245 while ((i <
sizeof(zone) - 1) && isalpha((
int) *tz)) {
251 minutes += hours * 60;
255 tz = strchr(tz,
',');
258 sprintf(timezone,
"TIMEZONE=%s::%d", zone, minutes);
261 if (extractDate(tz, ¤t, start) != OK)
264 tz = strchr(tz + 1,
',');
267 if (extractDate(tz, ¤t, stop) != OK)
271 sprintf(timezone,
"TIMEZONE=%s::%d:%s:%s", zone, minutes, start, stop);
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
EPICS time stamp, for use from C code.
LIBCOM_API int epicsStdCall epicsTimeToTM(struct tm *pDest, unsigned long *pNSecDest, const epicsTimeStamp *pSrc)
Convert epicsTimeStamp to struct tm in local time zone.