Class epicsTime
Defined in File epicsTime.h
Class Documentation
-
class epicsTime
C++ time stamp object.
Holds an EPICS time stamp, and provides conversion functions for both input and output from/to other types.
Note
Time conversions: The epicsTime implementation will properly convert between the various formats from the beginning of the EPICS epoch until at least 2038. Unless the underlying architecture support has defective POSIX, BSD/SRV5, or standard C time support the EPICS implementation should be valid until 2106.
epicsTimeStamp conversions
Convert to and from EPICS epicsTimeStamp format
-
inline operator const epicsTimeStamp&() const
Convert to epicsTimeStamp.
-
epicsTime(const epicsTimeStamp &replace)
Construct from epicsTimeStamp.
-
inline epicsTime &operator=(const epicsTimeStamp &replace)
Assign from epicsTimeStamp.
ANSI C time_t conversions
Convert to and from ANSI C
time_t
wrapper .-
inline operator time_t_wrapper() const
Convert to ANSI C
time_t
.
-
inline epicsTime(const time_t_wrapper &replace)
Construct from ANSI C
time_t
.
-
inline epicsTime &operator=(const time_t_wrapper &replace)
Assign from ANSI C
time_t
.
ANSI C struct tm local-time conversions
Convert to and from ANSI Cs
struct tm
(with nano seconds), adjusted for the local time zone.-
inline operator local_tm_nano_sec() const
Convert to
struct tm
in local time zone.
-
inline epicsTime(const local_tm_nano_sec &replace)
Construct from
struct tm
in local time zone.
-
inline epicsTime &operator=(const local_tm_nano_sec &replace)
Assign from
struct tm
in local time zone.
ANSI C struct tm UTC conversions
Convert to and from ANSI Cs
struct tm
(with nano seconds), adjusted for Greenwich Mean Time (UTC).-
inline operator gm_tm_nano_sec() const
Convert to
struct tm
in UTC/GMT.
-
inline epicsTime(const gm_tm_nano_sec &replace)
Construct from
struct tm
in UTC/GMT.
-
inline epicsTime &operator=(const gm_tm_nano_sec &replace)
Assign from
struct tm
in UTC.
POSIX RT struct timespec conversions
Convert to and from the POSIX RealTime
struct timespec
format.BSD’s struct timeval conversions
Convert to and from the BSD
struct timeval
format.Arithmetic operators
Standard operators involving epicsTime objects and time differences which are always expressed as a
double
in seconds.Comparison operators
Standard comparisons between epicsTime objects.
Public Types
-
typedef std::runtime_error unableToFetchCurrentTime
Exception: Time provider problem.
-
typedef std::logic_error formatProblemWithStructTM
Exception: Bad field(s) in
struct tm
Public Functions
-
inline epicsTime()
The default constructor sets the time to the EPICS epoch.
-
inline size_t strftime(char *pBuff, size_t bufLength, const char *pFormat) const
Convert to string in user-specified format.
This method extends the standard C library routine strftime(). See your OS documentation for details about the standard routine. The epicsTime method adds support for printing the fractional portion of the time. It searches the format string for the sequence
%0f
where n is the desired precision, and uses this format to convert the fractional seconds with the requested precision. For example:This will print the current time in the format:epicsTime time = epicsTime::getCurrent(); char buf[30]; time.strftime(buf, 30, "%Y-%m-%d %H:%M:%S.%06f"); printf("%s\n", buf);
2001-01-26 20:50:29.813505
-
inline void show(unsigned interestLevel) const
Dump current state to standard out.
Public Static Functions
-
static inline epicsTime getEvent(const epicsTimeEvent &evt)
Get time of event system event.
Returns an epicsTime indicating when the associated event system event last occurred.
-
inline operator const epicsTimeStamp&() const