From e8a396074cf62a4baab4079e8a02bd096a069004 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 28 Jun 2000 13:56:14 +0000 Subject: [PATCH] make tsStampFromLocal and tsStampToLocal public --- src/libCom/tsDefs.h | 34 ++++++++++++++++++++++++++++++++++ src/libCom/tsSubr.c | 32 ++++++-------------------------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/libCom/tsDefs.h b/src/libCom/tsDefs.h index 212aa6719..6c67625f8 100644 --- a/src/libCom/tsDefs.h +++ b/src/libCom/tsDefs.h @@ -78,6 +78,28 @@ typedef struct TS_STAMP { epicsUInt32 nsec; /* nanoseconds within second */ } TS_STAMP; +/*--------------------------------------------------------------------------- +* tsDetail +* breakdown structure for working with secPastEpoch +*----------------------------------------------------------------------------*/ + +typedef struct tsDetail { + int year; /* 4 digit year */ + int dayYear; /* day number in year; 0 = Jan 1 */ + int monthNum; /* month number; 0 = Jan */ + int dayMonth; /* day number; 0 = 1st of month */ + int hours; /* hours within day */ + int minutes; /* minutes within hour */ + int seconds; /* seconds within minute */ + int dayOfWeek; /* weekday number; 0 = Sun */ + int leapYear; /* (0, 1) for year (isn't, is) a leap year */ + char dstOverlapChar; /* indicator for distinguishing duplicate + times in the `switch to standard' time period: + ':'--time isn't ambiguous; + 's'--time is standard time + 'd'--time is daylight time */ +} TS_DETAIL; + /*---------------------------------------------------------------------------- * TS_TEXT_xxx text type codes for converting between text and time stamp * @@ -160,6 +182,16 @@ enum tsTextType{ #if defined(__STDC__) || defined(__cplusplus) +epicsShareFunc void epicsShareAPI tsStampFromLocal( +TS_STAMP *pStamp, +struct tsDetail *pT +); + +epicsShareFunc void epicsShareAPI tsStampToLocal( +TS_STAMP stamp, +struct tsDetail *pT +); + epicsShareFunc long epicsShareAPI tsLocalTime (TS_STAMP *pStamp); epicsShareFunc void epicsShareAPI tsAddDouble( @@ -201,6 +233,8 @@ char **pText /* IO ptr to ptr to string containing time and date */ #else /* !defined(__STDC__) && !defined(__cplusplus) */ +epicsShareFunc void epicsShareAPI tsStampFromLocal(); +epicsShareFunc void epicsShareAPI tsStampToLocal(); epicsShareFunc long epicsShareAPI tsLocalTime (); epicsShareFunc void epicsShareAPI tsAddDouble(); epicsShareFunc int epicsShareAPI tsCmpStamps(); diff --git a/src/libCom/tsSubr.c b/src/libCom/tsSubr.c index b78ddfc8f..2fa37e6d6 100644 --- a/src/libCom/tsSubr.c +++ b/src/libCom/tsSubr.c @@ -91,6 +91,8 @@ * long tsLocalTime( >pStamp ) * long tsRoundDownLocal(<>pStamp, intervalUL ) * long tsRoundUpLocal( <>pStamp, intervalUL ) +* void tsStampFromLocal( >pStamp, detail ) +* void tsStampToLocal( pStamp, >detail ) * char *tsStampToText( pStamp, textType, >textBuffer ) * TS_TEXT_MONDDYYYY buf[32] * TS_TEXT_MMDDYY buf[28] @@ -186,29 +188,7 @@ #define TS_MAX_YEAR TS_EPOCH_YEAR+134 /* ULONG can handle 135 years */ #define TS_TRUNC 1000000 /* truncate to milli-second significance */ -/*/subhead struct tsDetail---------------------------------------------------- -* breakdown structure for working with secPastEpoch -*----------------------------------------------------------------------------*/ - -struct tsDetail { - int year; /* 4 digit year */ - int dayYear; /* day number in year; 0 = Jan 1 */ - int monthNum; /* month number; 0 = Jan */ - int dayMonth; /* day number; 0 = 1st of month */ - int hours; /* hours within day */ - int minutes; /* minutes within hour */ - int seconds; /* seconds within minute */ - int dayOfWeek; /* weekday number; 0 = Sun */ - int leapYear; /* (0, 1) for year (isn't, is) a leap year */ - char dstOverlapChar; /* indicator for distinguishing duplicate - times in the `switch to standard' time period: - ':'--time isn't ambiguous; - 's'--time is standard time - 'd'--time is daylight time */ -}; -static void tsStampFromLocal(TS_STAMP *pStamp, struct tsDetail *pT); -static void tsStampToLocal(TS_STAMP stamp,struct tsDetail *pT); static void tsStampToLocalZone(TS_STAMP *pStamp,struct tsDetail *pT); static void tsInitMinWest(void); @@ -846,7 +826,7 @@ long epicsShareAPI tsRoundUpLocal(TS_STAMP *pStamp, unsigned long interval) return retStat; } -/*+/internal****************************************************************** +/*+/subr********************************************************************** * NAME tsStampFromLocal - convert time stamp to local time * * DESCRIPTION @@ -860,7 +840,7 @@ long epicsShareAPI tsRoundUpLocal(TS_STAMP *pStamp, unsigned long interval) * o doesn't handle 0 time stamps for time zones west of Greenwich * *-*/ -static void tsStampFromLocal(TS_STAMP *pStamp, struct tsDetail *pT) +void epicsShareAPI tsStampFromLocal(TS_STAMP *pStamp, struct tsDetail *pT) { long retStat=S_ts_OK;/* return status to caller */ @@ -936,7 +916,7 @@ static void tsStampFromLocal(TS_STAMP *pStamp, struct tsDetail *pT) *pStamp = stamp; } -/*+/internal****************************************************************** +/*+/subr********************************************************************** * NAME tsStampToLocal - convert time stamp to local time * * DESCRIPTION @@ -950,7 +930,7 @@ static void tsStampFromLocal(TS_STAMP *pStamp, struct tsDetail *pT) * o doesn't handle 0 time stamps for time zones west of Greenwich * *-*/ -static void tsStampToLocal(TS_STAMP stamp,struct tsDetail *pT) +void epicsShareAPI tsStampToLocal(TS_STAMP stamp,struct tsDetail *pT) { int dstBegin; /* day DST begins */ int dstEnd; /* day DST ends */