mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
timeUtils.cpp File Reference

Definitions for utilities for working with time. More...

Definitions for utilities for working with time.

Author
Jared R. Males (jared.nosp@m.male.nosp@m.s@gma.nosp@m.il.c.nosp@m.om)

Definition in file timeUtils.cpp.

Go to the source code of this file.

Namespaces

 mx
 The mxlib c++ namespace.
 

Functions

void mx::sys::sleep (unsigned sec)
 Sleep for a specified period in seconds. More...
 
void mx::sys::milliSleep (unsigned msec)
 Sleep for a specified period in milliseconds. More...
 
void mx::sys::microSleep (unsigned usec)
 Sleep for a specified period in microseconds. More...
 
void mx::sys::nanoSleep (unsigned nsec)
 Sleep for a specified period in nanoseconds. More...
 
void mx::sys::timespecAddNsec (timespec &ts, unsigned nsec)
 Adds a time offset to an existing timespec. More...
 
double mx::sys::Cal2mjd (int yr, int mon, int day, int hr, int min, double sec)
 Converts a Gregorian calendar date into modified Julian date (MJD). More...
 
int mx::sys::ISO8601dateBreakdown (int &yr, int &mon, int &day, int &hr, int &min, double &sec, const std::string &fdate)
 Parse an ISO8601 date of the form "YYYY-MM-DDTHH:MM:SS.S" into the individual components. More...
 
double mx::sys::ISO8601date2mjd (const std::string &fdate)
 Parse an ISO8601 date of the form "YYYY-MM-DDTHH:MM:SS.S" and return the modified Julian date (MJD) More...
 
template<>
std::string mx::sys::ISO8601DateTimeStr< time_t > (const time_t &timeIn, int timeZone)
 Get a date-time string in ISO 8601 format for time_t. More...
 
template<>
std::string mx::sys::ISO8601DateTimeStr< timespec > (const timespec &timeIn, int timeZone)
 Get a date-time string in ISO 8601 format for timespec. More...
 
std::string mx::sys::ISO8601DateTimeStr (int timeZone=0)
 Get a date-time string in ISO 8601 format for the current UTC time. More...
 
std::string mx::sys::ISO8601DateTimeStrMJD (const double &timeIn, int timeZone=0)
 Get a date-time string in ISO 8601 format for an MJD. More...
 
int mx::sys::timeStamp (std::string &tstamp, timespec &ts)
 Get a timestamp string in the form YYYYMMDDHHMMSS.SSSSSSSSS. More...
 
int mx::sys::timespecUTC2TAIMJD (double &djm, double &djmf, const timespec &tsp, tm *tm0)
 Convert a UTC timespec to TAI modified Julian date. More...
 
timespec mx::sys::meanTimespec (timespec ts1, timespec ts2)
 Calculate the mean time of two times given by timespecs. More...
 
bool mx::sys::tscomp::operator< (timespec const &tsL, timespec const &tsR)
 Timespec comparison operator < (see caveats) More...
 
bool mx::sys::tscomp::operator> (timespec const &tsL, timespec const &tsR)
 Timespec comparison operator > (see caveats) More...
 
bool mx::sys::tscomp::operator== (timespec const &tsL, timespec const &tsR)
 Timespec comparison operator == (see caveats) More...
 
bool mx::sys::tscomp::operator<= (timespec const &tsL, timespec const &tsR)
 Timespec comparison operator <= (see caveats) More...
 
bool mx::sys::tscomp::operator>= (timespec const &tsL, timespec const &tsR)
 Timespec comparison operator >= (see caveats) More...
 

Function Documentation

◆ meanTimespec()

timespec mx::sys::meanTimespec ( timespec  ts1,
timespec  ts2 
)

Calculate the mean time of two times given by timespecs.

Returns
the mean value of the inputs.
Parameters
[in]ts1one of the times to average
[in]ts2the other time to average

Definition at line 278 of file timeUtils.cpp.

References mx::sys::meanTimespec().

Referenced by mx::sys::ISO8601DateTimeStr(), and mx::sys::meanTimespec().