FARGOS/VISTA Object Management Environment Core
..
|
Representation of localized expanded UNITS-since-epoch. More...
#include <time_point.hpp>
Public Types | |
enum | { OUTPUT_DATE =1, OUTPUT_TIME =2 } |
Public Member Functions | |
void | initializeWithUnitsFromEpoch (time_t secondsSinceEpoch, uint64_t fractionInUnits, int skewByMinutes=0, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) |
Initialize with seconds from POSIX epoch, fractional component and optional skew from localtime. More... | |
void | initializeWithNanosecondsFromEpoch (uint64_t nanosecondsSinceEpoch, time_t secondsSinceEpoch=0, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday, int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
Initialize with time specified as nanoseconds from POSIX epoch. More... | |
TimePointOfGranularity () | |
Null constructor, leaves in undefined state. More... | |
TimePointOfGranularity (const struct tm &explodedTime, uint64_t fraction=0) | |
Construct from standard broken-out time structure. More... | |
template<unsigned int PT_UNITS> | |
TimePointOfGranularity (const POSIXtimeInUnits< PT_UNITS > ptTime, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday, int skewByMinutes=0) | |
Construct from arbitrary POSIXtimeInUnits<> object. More... | |
TimePointOfGranularity (const char *dayAndTime, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) | |
Construct from text string specifying date and time. More... | |
TimePointOfGranularity (const char *day, const char *timeOfDay, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) | |
Construct from text string specifying date and time. More... | |
TimePointOfGranularity (time_t secondsSinceEpoch, uint64_t fraction=0, int skewByMinutes=0, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) | |
Construct from seconds from POSIX epoch and optional fractional component and skew from localtime. More... | |
template<unsigned int INCOMING_UNITS = UNITS> | |
TimePointOfGranularity< UNITS > & | operator= (const TimePointOfGranularity< INCOMING_UNITS > &arg) |
assignment operator from a TimePointOfGranularity object. More... | |
TimePointOfGranularity< UNITS > & | operator= (const struct tm &POSIXexpandedDate) |
assignment operator from a tm structure. More... | |
operator const struct tm & () const OME_ALWAYS_INLINE | |
Cast operator to return reference to tm structure. More... | |
uint64_t | convertToNanosecondsSinceEpoch (const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) const |
Convert expanded time to nanoseconds since POSIX epoch. More... | |
uint64_t | convertToCustomEpochUnits (uint64_t desired_granularity=UNITS, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) const |
Convert expanded time to custom units since POSIX epoch. More... | |
uint64_t | getRelativeUnitsInDay () const |
Get relative units within a day. More... | |
uint64_t | getRelativeMicrosecondsInDay () const |
Get relative microseconds within a day. More... | |
uint64_t | getRelativeNanosecondsInDay () const |
Get relative nanoseconds within a day. More... | |
const char * | convertDayAndTime (const char *dayAndTime, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) |
Convert string representing day and time into expanded time structure. More... | |
int | convertDayAndTime (const char *day, const char *timeOfDay, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) |
Convert strings representing date and time into expanded time structure. More... | |
char * | formatIntoString (char *bfr, uint_fast8_t bfrLen, uint_fast8_t *resultLen=nullptr, uint_fast8_t fieldsWanted=OUTPUT_DATE|OUTPUT_TIME, const char *fieldSeparators="/:. ") const |
Format into text string. More... | |
template<unsigned int ALT_UNITS> | |
int | compareDate (const TimePointOfGranularity< ALT_UNITS > &arg) const |
Compare the date portion of a TimePointOfGranularity. More... | |
Static Public Member Functions | |
static CONSTEXPR uint64_t | getUnitsPerSecond () OME_CONST_FUNCTION OME_ALWAYS_INLINE |
Get units per second represented by fractional component. More... | |
Public Attributes | |
struct tm | expandedTime |
Locale-specific time, conforms to POSIX, C89 and onwards. More... | |
uint64_t | fractionalUnits |
Fractional seconds in granularity of UNITS-per-second. More... | |
Representation of localized expanded UNITS-since-epoch.
|
inline |
Null constructor, leaves in undefined state.
|
inlineexplicit |
Construct from standard broken-out time structure.
explodedTime | provides the desired locale-specific time. |
fraction | is an optional parameter that specifies the fraction of a second in a granularity of UNITS. |
References TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inlineexplicit |
Construct from arbitrary POSIXtimeInUnits<> object.
ptTime | specifies an unambiguous time specified as POSIXtimeInUnits with granularity PT_UNITS. |
cachedTimeInfo | provides an TimePointCache object to enable the avoidance of expensive calculations if the time in question is within the range supported by the TimePointCache object. |
skewByMinutes | is an optional parameter that allows skewing the provided time by the specified number of minutes. |
References POSIXtimeInUnits< UNITS >::convertToCustomEpochUnits(), and TimePointOfGranularity< UNITS >::initializeWithUnitsFromEpoch().
|
inlineexplicit |
Construct from text string specifying date and time.
dayAndTime | specifies the date and time as a single contiguous string. |
cachedTimeInfo | points to an optional TimePointCache that can be used to accelerate conversions if the date being converted corresponds to the TimePointCache. |
References TimePointOfGranularity< UNITS >::convertDayAndTime().
|
inline |
Construct from text string specifying date and time.
day | specifies the date |
timeOfDay | specifies the time of day (hours, minutes, seconds) |
cachedTimeInfo | is an optional TimePointCache that can be used to accelerate conversions if the date being converted corresponds to the TimePointCache. |
References TimePointOfGranularity< UNITS >::convertDayAndTime().
|
inlineexplicit |
Construct from seconds from POSIX epoch and optional fractional component and skew from localtime.
secondsSinceEpoch | provides the number of seconds since the POSIX epoch. |
fraction | specifies the number of fractional units in a partial second. Defaults to 0. |
skewByMinutes | indicates the number of minutes the expanded time should be shifted from localtime. Defaults to 0. |
cachedTimeInfo | provides an optional TimePointCache object to enable the avoidance of expensive calculations if the time in question is within the range supported by the TimePointCache object. |
References TimePointOfGranularity< UNITS >::initializeWithUnitsFromEpoch().
|
inline |
Compare the date portion of a TimePointOfGranularity.
arg | specifies a TimePointOfGranularity of arbitrary granularity. |
The year, month, and day of the month are compared, not the time-of-day component.
References TimePointOfGranularity< UNITS >::expandedTime.
|
inline |
Convert strings representing date and time into expanded time structure.
day | points to a text string that holds a date. |
timeOfDay | points to a text string that holds a time. |
cachedTimeInfo | points to a TimePointCache object that can be used to accelerate conversion of times that are in UTC. |
References TimePointOfGranularity< UNITS >::convertDayAndTime().
|
inline |
Convert string representing day and time into expanded time structure.
dayAndTime | points to a text string that holds a day and time. |
cachedTimeInfo | points to a TimePointCache object that can be used to accelerate conversion of times that are in UTC. |
The following formats are recognized for time: HHMMSS[.fraction][Z] [{AM|PM}], H:M:S[.fraction][Z] [{AM|PM}]
References TimePointOfGranularity< UNITS >::expandedTime, TimePointOfGranularity< UNITS >::fractionalUnits, TimePointCache::offsetFromUTC(), and text2uint32().
Referenced by TimePointOfGranularity< UNITS >::convertDayAndTime(), and TimePointOfGranularity< UNITS >::TimePointOfGranularity().
|
inline |
Convert expanded time to custom units since POSIX epoch.
desired_granularity | specifies the granularity of the converted result. It does not have to match the units used by the TimePointOfGranularity representation. |
cachedTimeInfo | specifies a TimePointCache object that can be used to accelerate the conversion of times within the date covered by the cache object. |
References CALL_TZSET, TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inline |
Convert expanded time to nanoseconds since POSIX epoch.
cachedTimeInfo | provides an optional TimePointCache object to enable the avoidance of expensive calculations if the time in question is within the range supported by the TimePointCache object. |
References CALL_TZSET, TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inline |
Format into text string.
bfr | specifies the output buffer, |
bfrLen | specified the length of available space |
resultLen | is an option pointer to a location into which the length of the result can be stored. |
fieldsWanted | is a bit mask indicating the desired elements. |
fieldSeparators | is a 4-character string indicating the separator elements between the year/month/day, hour:min:sec, fractional and date vs. time groupings. It defaults to "/:. ". If one of the individual elements is a null character, no separator will be output. |
References TimePointOfGranularity< UNITS >::expandedTime, TimePointOfGranularity< UNITS >::fractionalUnits, numberAs4Digits, numberAsTwoDigits, TimePointOfGranularity< UNITS >::OUTPUT_DATE, TimePointOfGranularity< UNITS >::OUTPUT_TIME, and uint_to_ascii_right_justified().
Referenced by LogMessageRecord::formatRecordAsText(), operator<<(), and ReadBinaryLog::outputAssembledLine().
|
inline |
Get relative microseconds within a day.
References TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inline |
Get relative nanoseconds within a day.
References TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inline |
Get relative units within a day.
References TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inlinestatic |
Get units per second represented by fractional component.
|
inline |
Initialize with time specified as nanoseconds from POSIX epoch.
nanosecondsSinceEpoch | provides the number of nanoseconds since the POSIX epoch. This can be the total number of nanoseconds or only the sub-second fraction. |
secondsSinceEpoch | provides the number of seconds since the POSIX epoch. If the complete number of nanoseconds was provided by nanosecondsSinceEpoch, this will be 0. |
cachedTimeInfo | provides a TimePointCache object to enable the avoidance of expensive calculations if the time in question is within the range supported by the TimePointCache object. |
skewByMinutes | indicates the number of minutes the expanded time should be shifted from localtime. Defaults to 0. |
References TimePointOfGranularity< UNITS >::initializeWithUnitsFromEpoch().
|
inline |
Initialize with seconds from POSIX epoch, fractional component and optional skew from localtime.
secondsSinceEpoch | provides the number of seconds since the POSIX epoch. |
fractionInUnits | specifies the number of fractional units in a partial second. Values greater than a whole second are accepted. Defaults to 0. |
skewByMinutes | indicates the number of minutes the expanded time should be shifted from localtime. Defaults to 0. |
cachedTimeInfo | provides an optional TimePointCache object to enable the avoidance of expensive calculations if the time in question is within the range supported by the TimePointCache object. |
References CALL_TZSET, TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
Referenced by TimePointOfGranularity< UNITS >::initializeWithNanosecondsFromEpoch(), and TimePointOfGranularity< UNITS >::TimePointOfGranularity().
|
inlineexplicit |
Cast operator to return reference to tm structure.
References TimePointOfGranularity< UNITS >::expandedTime.
|
inline |
assignment operator from a tm structure.
References TimePointOfGranularity< UNITS >::expandedTime, and TimePointOfGranularity< UNITS >::fractionalUnits.
|
inline |
assignment operator from a TimePointOfGranularity object.
References TimePointOfGranularity< UNITS >::expandedTime, TimePointOfGranularity< UNITS >::fractionalUnits, and powerOf10Constant().
struct tm TimePointOfGranularity< UNITS >::expandedTime |
Locale-specific time, conforms to POSIX, C89 and onwards.
Referenced by TimePointOfGranularity< UNITS >::compareDate(), TimePointOfGranularity< UNITS >::convertDayAndTime(), TimePointOfGranularity< UNITS >::convertToCustomEpochUnits(), TimePointOfGranularity< UNITS >::convertToNanosecondsSinceEpoch(), TimePointOfGranularity< UNITS >::formatIntoString(), TimePointOfGranularity< UNITS >::getRelativeMicrosecondsInDay(), TimePointOfGranularity< UNITS >::getRelativeNanosecondsInDay(), TimePointOfGranularity< UNITS >::getRelativeUnitsInDay(), TimePointOfGranularity< UNITS >::initializeWithUnitsFromEpoch(), TimePointOfGranularity< UNITS >::operator const struct tm &(), TimePointOfGranularity< UNITS >::operator=(), and TimePointOfGranularity< UNITS >::TimePointOfGranularity().
uint64_t TimePointOfGranularity< UNITS >::fractionalUnits |
Fractional seconds in granularity of UNITS-per-second.
Referenced by TimePointOfGranularity< UNITS >::convertDayAndTime(), TimePointOfGranularity< UNITS >::convertToCustomEpochUnits(), TimePointOfGranularity< UNITS >::convertToNanosecondsSinceEpoch(), TimePointOfGranularity< UNITS >::formatIntoString(), TimePointOfGranularity< UNITS >::getRelativeMicrosecondsInDay(), TimePointOfGranularity< UNITS >::getRelativeNanosecondsInDay(), TimePointOfGranularity< UNITS >::getRelativeUnitsInDay(), TimePointOfGranularity< UNITS >::initializeWithUnitsFromEpoch(), TimePointOfGranularity< UNITS >::operator=(), and TimePointOfGranularity< UNITS >::TimePointOfGranularity().
![]() | Generated: Tue Jul 28 2020 16:03:27
Support Information |