Go to the documentation of this file. 1 #ifndef _TIME_POINT_HPP_
2 #define _TIME_POINT_HPP_ "$Id: time_point.hpp 456 2020-07-23 20:25:49Z geoff $"
51 #define CALL_TZSET() if (TimePointCache::TimePoint_setTZ == false) TimePointCache::doSetTZ()
53 #define CALL_TZSET() do { } while (0)
63 return (1 + int_digitsNeeded<UNITS / 10>());
95 static bool TimePoint_setTZ;
98 static void doSetTZ();
191 struct tm expandedFields;
194 localtime_s(&expandedFields, &(asIfOnDay.tv_sec));
196 localtime_r(&(asIfOnDay.tv_sec), &expandedFields);
225 if (
isForDay(asOfPOSIXepoch) ==
true) {
228 struct timespec todayTime;
229 if (asOfPOSIXepoch == 0) {
235 todayTime.tv_sec = asOfPOSIXepoch;
236 todayTime.tv_nsec = 0;
245 bool isForDay(
const struct tm &dayOfInterest)
const {
246 if ((
local3am.tm_mday == dayOfInterest.tm_mday) &&
247 (
local3am.tm_mon == dayOfInterest.tm_mon) &&
248 (
local3am.tm_year == dayOfInterest.tm_year) ) {
294 std::map<time_t,TimePointCache *>::const_iterator i =
timeTable.find(t);
319 enum { one_billion = 1000000000UL };
321 #pragma warning(suppress : 4127)
323 if (UNITS == one_billion) {
325 (
static_cast<int64_t
>(skewByMinutes) * (
static_cast<int64_t
>(60) * UNITS));
327 enum { NS_PER_UNIT = one_billion / UNITS };
328 int64_t fractionalUnits;
334 uint64_t totalSeconds = time_ns.
time_sec + (skewByMinutes * 60);
353 #pragma warning(suppress : 4127)
355 if (desired_granularity == UNITS) {
358 if (desired_granularity > UNITS) {
365 const uint64_t intRatio = desired_granularity / UNITS;
366 if ((desired_granularity - (UNITS * intRatio)) == 0) {
380 const uint64_t intRatio = UNITS / desired_granularity;
381 if ((UNITS - (desired_granularity * intRatio)) == 0) {
392 uint64_t result = (secs * desired_granularity);
395 uint64_t new_fraction = (fraction * desired_granularity) / UNITS;
396 result += new_fraction;
432 uint64_t secondsAsUnits = (
static_cast<uint64_t
>(seconds) + (skewByMinutes * 60)) * UNITS;
472 enum { one_billion = 1000000000UL };
474 #pragma warning(suppress : 4127)
476 if (UNITS == one_billion) {
482 uint64_t new_fraction = (fraction * one_billion) / UNITS;
483 uint64_t result = (secs * one_billion) + new_fraction;
491 return (
static_cast<time_t
>(seconds));
623 uint64_t fractionInUnits,
int skewByMinutes=0,
626 uint64_t extraSeconds, fraction;
628 if (fractionInUnits < UNITS) {
630 fraction = fractionInUnits;
632 extraSeconds = fractionInUnits / UNITS;
633 fraction = fractionInUnits - (extraSeconds * UNITS);
635 time_t skewedTime = secondsSinceEpoch + extraSeconds + (skewByMinutes * 60);
637 if ((cachedTimeInfo !=
nullptr) &&
638 (skewedTime >= cachedTimeInfo->local3amEpoch) &&
639 (skewedTime < cachedTimeInfo->localEndOfDayEpoch)) {
642 time_t total_seconds = skewedTime - cachedTimeInfo->local3amEpoch;
643 time_t hours = total_seconds / (60 * 60);
644 time_t totalMinSecs = total_seconds - (hours * (60 * 60));
645 time_t mins = totalMinSecs / 60;
646 time_t secs = totalMinSecs - (mins * 60);
682 time_t secondsSinceEpoch=0,
686 enum { one_billion = 1000000000UL };
690 #pragma warning(suppress : 4127)
692 if (UNITS == one_billion) {
694 nanosecondsSinceEpoch, skewByMinutes, cachedTimeInfo);
696 enum { NS_PER_UNIT = one_billion / UNITS };
697 uint64_t extraSeconds, nanoseconds;
699 if (nanosecondsSinceEpoch < one_billion) {
701 nanoseconds = nanosecondsSinceEpoch;
703 extraSeconds = nanosecondsSinceEpoch / one_billion;
704 nanoseconds = nanosecondsSinceEpoch - (extraSeconds * one_billion);
706 time_t totalSeconds = secondsSinceEpoch + extraSeconds;
708 uint64_t unit_fraction = nanoseconds / NS_PER_UNIT;
710 skewByMinutes, cachedTimeInfo);
740 template <
unsigned int PT_UNITS>
751 #if 0 // a non-default copy constructor creates unwanted overhead
800 uint64_t fraction=0,
int skewByMinutes=0,
804 skewByMinutes, cachedTimeInfo);
812 #pragma warning(suppress : 4127)
814 if (INCOMING_UNITS == UNITS) {
818 #pragma warning(suppress : 4127)
820 if (UNITS >= INCOMING_UNITS) {
850 enum { one_billion = 1000000000UL };
852 if ((cachedTimeInfo !=
nullptr) &&
853 (
expandedTime.tm_mday == cachedTimeInfo->local3am.tm_mday) &&
854 (
expandedTime.tm_mon == cachedTimeInfo->local3am.tm_mon) &&
855 (
expandedTime.tm_year == cachedTimeInfo->local3am.tm_year) &&
864 #if 0 // By definition, 03:00:00 AM can't have these cases
874 uint64_t seconds = hours * (60 * 60) + (mins * 60) + secs +
875 cachedTimeInfo->local3amEpoch;
876 uint64_t nanoseconds = (seconds * one_billion);
882 return (nanoseconds);
890 time_t seconds = mktime(
const_cast<struct tm *
>(&
expandedTime));
891 uint64_t nanoseconds = (seconds * one_billion);
892 if (UNITS == one_billion) {
897 return (nanoseconds);
914 if ((cachedTimeInfo !=
nullptr) &&
915 (
expandedTime.tm_mday == cachedTimeInfo->local3am.tm_mday) &&
916 (
expandedTime.tm_mon == cachedTimeInfo->local3am.tm_mon) &&
917 (
expandedTime.tm_year == cachedTimeInfo->local3am.tm_year) &&
926 #if 0 // By definition, 03:00:00 AM can't have these cases
936 uint64_t seconds = hours * (60 * 60) + (mins * 60) + secs +
937 cachedTimeInfo->local3amEpoch;
938 uint64_t units = (seconds * desired_granularity);
940 #pragma warning(suppress : 4127)
942 if (desired_granularity == UNITS) {
953 time_t seconds = mktime(
const_cast<struct tm *
>(&
expandedTime));
954 uint64_t units = (seconds * desired_granularity) +
970 enum { one_million = 1000000 };
974 uint64_t result = (seconds * one_million) +
981 enum { one_billion = 1000000000UL };
985 uint64_t result = (seconds * one_billion) +
1021 const char *cp = dayAndTime;
1022 while (*cp ==
' ') ++cp;
1023 const char *fieldStart = cp;
1024 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1025 uint32_t fieldLen = (uint32_t) (cp - fieldStart);
1027 if (fieldLen == 8) {
1032 }
else if ((*cp ==
'/') || (*cp ==
'-')) {
1037 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1038 fieldLen = (uint32_t) (cp - fieldStart);
1041 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1042 fieldLen = (uint32_t) (cp - fieldStart);
1045 }
else if (fieldLen == 0) {
1046 while ((*cp !=
' ') && (*cp !=
'\0')) ++cp;
1047 fieldLen = (uint32_t) (cp - fieldStart);
1049 return (fieldStart);
1056 switch (fieldStart[0] & ~0x20) {
1058 switch (fieldStart[1] & ~0x20) {
1074 switch (fieldStart[1] & ~0x20) {
1079 switch (fieldStart[2] & ~0x20) {
1091 switch (fieldStart[1] & ~0x20) {
1093 switch (fieldStart[2] & ~0x20) {
1115 return (fieldStart);
1117 while (*cp ==
' ') ++cp;
1119 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1120 fieldLen = (uint32_t) (cp - fieldStart);
1122 while (*cp ==
' ') ++cp;
1124 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1125 fieldLen = (uint32_t) (cp - fieldStart);
1131 if (cp == fieldStart) {
1132 if ((*cp ==
'@') || (*cp ==
'T')) {
1135 while (*cp ==
' ') ++cp;
1138 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1140 fieldLen = (uint32_t) (cp - fieldStart);
1141 if (fieldLen == 6) {
1145 }
else if (fieldLen == 4) {
1149 }
else if (fieldLen == 2) {
1153 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1154 fieldLen = (uint32_t) (cp - fieldStart);
1158 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1159 fieldLen = (uint32_t) (cp - fieldStart);
1170 if ((*cp ==
'.') || (*cp ==
':')) {
1172 while ((*cp >=
'0') && (*cp <=
'9')) ++cp;
1173 fieldLen = (uint32_t) (cp - fieldStart);
1174 uint32_t fraction =
text2uint32(fieldStart, fieldLen);
1175 int tensPlaces = fieldLen;
1176 const int digitsWanted = int_digitsNeeded<UNITS>();
1177 while (tensPlaces < digitsWanted) {
1181 while (tensPlaces > digitsWanted) {
1190 utcSkew = cachedTimeInfo->offsetFromUTC();
1196 int32_t hours = utcSkew / (60 * 60);
1198 utcSkew -= hours * (60 * 60);
1199 int32_t minutes = utcSkew / 60;
1218 while (*cp ==
' ') ++cp;
1220 char c1 = *(cp) & ~0x20;
1222 ((*(cp + 1) & ~0x20) ==
'M')) {
1225 }
else if ((c1 ==
'A') &&
1226 ((*(cp + 1) & ~0x20) ==
'M')) {
1243 char *fieldEnd = (
char *) memccpy(bfr, day,
'\0', 32);
1244 if (fieldEnd ==
nullptr) {
1247 *(fieldEnd - 1) =
' ';
1248 fieldEnd = (
char *) memccpy(fieldEnd, timeOfDay,
'\0', 32);
1249 if (fieldEnd ==
nullptr) {
1254 if (lastChar == bfr) {
1274 uint_fast8_t *resultLen=
nullptr,
1276 const char *fieldSeparators=
"/:. ")
const
1278 uint_fast8_t offset;
1279 uint_fast8_t field2Offset, field3Offset;
1283 if (fieldSeparators[0] !=
'\0') {
1287 bfr[4] = fieldSeparators[0];
1288 bfr[7] = fieldSeparators[0];
1301 uint32_t fractBfr[6];
1302 const int fractionalLen = int_digitsNeeded<UNITS>();
1303 if ((offset != 0) && (fieldSeparators[3] !=
'\0')) {
1305 bfr[offset] = fieldSeparators[3];
1308 uint_fast8_t fieldLen;
1309 if (fieldSeparators[1] !=
'\0') {
1310 field2Offset = offset + 3;
1311 field3Offset = offset + 6;
1313 bfr[offset+2] = fieldSeparators[1];
1314 bfr[offset+5] = fieldSeparators[1];
1316 field2Offset = offset + 2;
1317 field3Offset = offset + 4;
1325 if (fieldSeparators[2] !=
'\0') {
1326 bfr[offset] = fieldSeparators[2];
1332 memcpy(bfr+offset, fractText, fractionalLen);
1333 offset += fractionalLen;
1336 if (resultLen !=
nullptr) {
1337 *resultLen = offset;
1371 template<
typename STREAMTYPE,
unsigned int UNITS>
1382 template <
typename STREAMTYPE,
unsigned int UNITS>
TimePointCache(const struct tm &asIfOnDay)
Create a TimePointCache based around a local expanded time.
Definition: time_point.hpp:146
int clock_gettime_via_tick(struct timespec *result, bool force) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Definition: tick_time.h:290
@ OUTPUT_DATE
Definition: time_point.hpp:599
~TimePointCacheTable()
Definition: time_point.hpp:278
TimePointCache TimePointCacheForToday
Cached TimePoint information representing today.
struct tm lastTime
Definition: time_point.hpp:103
struct tm localEndOfDay
Definition: time_point.hpp:101
time_t local3amEpoch
Definition: time_point.hpp:107
int32_t utcDifferenceSeconds
Definition: time_point.hpp:109
POSIXtimeInUnits(time_t seconds, int64_t fractional, int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Construct a POSIXtimeInUnits from seconds since the POSIX epoch.
Definition: time_point.hpp:425
POSIXtimeInUnits< UNITS > & operator=(const TimeWithNanoseconds time_ns) OME_ALWAYS_INLINE
Assignment operator from TimeWithNanoseconds structure.
Definition: time_point.hpp:464
struct tm expandedTime
Locale-specific time, conforms to POSIX, C89 and onwards.
Definition: time_point.hpp:602
Time acquisition routines.
uint64_t fractionalUnits
Fractional seconds in granularity of UNITS-per-second.
Definition: time_point.hpp:603
int64_t unlock()
Release a previously locked mutex.
Definition: timed_mutex.cpp:156
std::map< time_t, TimePointCache * > timeTable
Definition: time_point.hpp:272
void assignFromTimeWithNanoseconds(const TimeWithNanoseconds time_ns, const int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Definition: time_point.hpp:317
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.
Definition: time_point.hpp:1273
int convertDayAndTime(const char *day, const char *timeOfDay, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday)
Convert strings representing date and time into expanded time structure.
Definition: time_point.hpp:1239
#define CALL_TZSET()
Definition: time_point.hpp:53
uint64_t time_in_units
holds total UNITS since POSIX epoch
Definition: time_point.hpp:315
char * uint_to_ascii_right_justified(uint32_t resultBfr[], uint_fast8_t bfrLen, uint64_t value, uint_fast8_t fieldLen, char fillChar)
Convert a binary integer into right-justified ASCII decimal text and pad on the left with a specified...
Definition: text2int.cpp:2718
uint64_t getRelativeUnitsInDay() const
Get relative units within a day.
Definition: time_point.hpp:960
bool operator<=(const POSIXtimeInUnits< ALT_UNITS > arg) const
Less-than-or-equal comparison against a POSIXtimeInUnits of arbitrary granularity.
Definition: time_point.hpp:521
Cache locale-specific time data around a particular point in time.
Definition: time_point.hpp:92
@ OUTPUT_TIME
Definition: time_point.hpp:600
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.
Definition: time_point.hpp:799
TimePointCache(const time_t asOfPOSIXepoch)
Create a TimePointCache based around a specific point in time.
Definition: time_point.hpp:124
TimePointOfGranularity(const char *day, const char *timeOfDay, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday)
Construct from text string specifying date and time.
Definition: time_point.hpp:781
const union Aligned4Chars numberAs4Digits[10000]
Definition: text2int.cpp:124
time_t lastTimeEpoch
Definition: time_point.hpp:108
#define OME_ALWAYS_OPTIMIZE(level)
Mark a function to be compiled with a specific level of optimization.
Definition: compiler_hints.h:406
TimePointOfGranularity()
Null constructor, leaves in undefined state.
Definition: time_point.hpp:716
bool operator<(const POSIXtimeInUnits< ALT_UNITS > arg) const
Less-than comparison against a POSIXtimeInUnits of arbitrary granularity.
Definition: time_point.hpp:543
Structure for representing time as relative seconds and nanoseconds.
Definition: get_time.h:24
bool operator>(const POSIXtimeInUnits< ALT_UNITS > arg) const
Greater-than comparison against a POSIXtimeInUnits of arbitrary granularity.
Definition: time_point.hpp:554
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.
Definition: time_point.hpp:622
struct tm utc3am
Definition: time_point.hpp:104
TimePointCache(const struct timespec &asIfOnDay)
Create a TimePointCache around a time expressed as a timespec, which is represented using the POSIX e...
Definition: time_point.hpp:138
bool isForDay(const struct tm &dayOfInterest) const
Definition: time_point.hpp:245
time_t getSeconds() const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Convert a POSIXtimeInUnits to seconds since the POSIX epoch.
Definition: time_point.hpp:489
static CONSTEXPR uint64_t getUnitsPerSecond() OME_CONST_FUNCTION OME_ALWAYS_INLINE
Get units per second represented by fractional component.
Definition: time_point.hpp:991
uint64_t time_nanosec
Definition: get_time.h:26
const char srcID[]
Definition: catSym.c:17
bool operator>=(const POSIXtimeInUnits< ALT_UNITS > arg) const
Greater-than-or-equal comparison against a POSIXtimeInUnits of arbitrary granularity.
Definition: time_point.hpp:532
TimePointOfGranularity< UNITS > & operator=(const struct tm &POSIXexpandedDate)
assignment operator from a tm structure.
Definition: time_point.hpp:831
struct tm local3am
Definition: time_point.hpp:102
TimePointOfGranularity(const struct tm &explodedTime, uint64_t fraction=0)
Construct from standard broken-out time structure.
Definition: time_point.hpp:724
bool isForDay(const time_t t) const OME_ALWAYS_INLINE
Definition: time_point.hpp:201
time_t localEndOfDayEpoch
Definition: time_point.hpp:106
POSIXtimeInUnits< 1U > POSIXtimeInSeconds
Convenience typedef for conventional 1-second resolution time.
Definition: time_point.hpp:587
int compareDate(const TimePointOfGranularity< ALT_UNITS > &arg) const
Compare the date portion of a TimePointOfGranularity.
Definition: time_point.hpp:1349
TimePointOfGranularity< UNITS > & operator=(const TimePointOfGranularity< INCOMING_UNITS > &arg)
assignment operator from a TimePointOfGranularity object.
Definition: time_point.hpp:809
CONSTEXPR unsigned int int_digitsNeeded() OME_CONST_FUNCTION OME_ALWAYS_INLINE
Via compile-time evaluation, compute log10(). Used to determine number digits required to display pre...
Definition: time_point.hpp:61
uint64_t convertToNanosecondsSinceEpoch() const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Convert a POSIXtimeInUnits to nanoseconds since the POSIX epoch.
Definition: time_point.hpp:471
TimePointOfGranularity< 1 > POSIXEpochTimePoint
Convenience typedef using conventional 1-second resolution.
Definition: time_point.hpp:1368
const char numberAsTwoDigits[100][3]
Table of 2-character strings representing 00-99.
Definition: text2int.cpp:20
Representation of localized expanded UNITS-since-epoch.
Definition: time_point.hpp:596
void initializeForDay(const struct tm &asIfOnDay)
Initialize a TimePointCache around an already expanded time, which is intended to reflect a local tim...
Definition: time_point.hpp:154
STREAMTYPE & operator<<(STREAMTYPE &o, const TimePointOfGranularity< UNITS > &t)
Output TimePointOfGranularity as text onto a stream-like object.
Definition: time_point.hpp:1372
Representation of UNITS-since-POSIX-epoch. This is an unambiguous time reference; there is no locale-...
Definition: time_point.hpp:313
void initializeForDay(const struct timespec &asIfOnDay)
Initialize a TimePointCache around a time specified using a timespec, which is based on the POSIX epo...
Definition: time_point.hpp:189
uint_fast32_t text2uint32(const char *textString, uint_fast8_t text_len) NONNULL_PARAMETERS(1) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Convert a sequence of text characters into an unsigned integer as quickly as possible....
Definition: text2int.h:79
Generic mutex implementation that supports timing statistics.
Definition: timed_mutex.hpp:51
Extreme-performance text/number conversion routines.
CONSTEXPR unsigned int int_digitsNeeded< 0 >()
Termination condition for safety.
Definition: time_point.hpp:73
TimePointOfGranularity(const POSIXtimeInUnits< PT_UNITS > ptTime, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday, int skewByMinutes=0)
Construct from arbitrary POSIXtimeInUnits<> object.
Definition: time_point.hpp:741
uint64_t getRelativeNanosecondsInDay() const
Get relative nanoseconds within a day.
Definition: time_point.hpp:980
bool operator!=(const POSIXtimeInUnits< ALT_UNITS > arg) const
Inequality comparison against a POSIXtimeInUnits of arbitrary granularity.
Definition: time_point.hpp:510
POSIXtimeInUnits(const TimeWithNanoseconds time_ns, int skewByMinutes=0) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Construct a POSIXtimeInUnits from a TimeWithNanoseconds structure.
Definition: time_point.hpp:444
bool operator==(const POSIXtimeInUnits< ALT_UNITS > arg) const
Equality comparison against a POSIXtimeInUnits of arbitrary granularity.
Definition: time_point.hpp:499
const char srcID[] OME_USED
Definition: tick_time.cpp:24
TimePointOfGranularity(const char *dayAndTime, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday)
Construct from text string specifying date and time.
Definition: time_point.hpp:768
static POSIXtimeInUnits< UNITS > getCurrentTime() OME_ALWAYS_INLINE
Get the current time as units-since-the-POSIX epoch.
Definition: time_point.hpp:564
TimePointCacheTable(const char *tableName="timeCache")
Definition: time_point.hpp:274
const TimePointCache & getCacheEntry(time_t t)
Returns a TimePointCache entry for the day indicated by the number of seconds since the POSIX epoch.
Definition: time_point.hpp:292
#define OME_CONST_FUNCTION
Mark as an idempotent function that only accesses arguments – no global data.
Definition: compiler_hints.h:390
uint64_t time_sec
Definition: get_time.h:25
uint64_t convertToCustomEpochUnits(uint64_t desired_granularity=UNITS) const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Converts from a POSIXtimeInUnits to an arbitrary granularity.
Definition: time_point.hpp:351
Manager for collection of shared memory variables.
Definition: shared_variable.hpp:193
const char * convertDayAndTime(const char *dayAndTime, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday)
Convert string representing day and time into expanded time structure.
Definition: time_point.hpp:1016
uint64_t convertToNanosecondsSinceEpoch(const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) const
Convert expanded time to nanoseconds since POSIX epoch.
Definition: time_point.hpp:849
TimePointOfGranularity< 1000000000 > NanosecondTimePoint
Desired standard granularity with nanosecond resolution.
Definition: time_point.hpp:1365
Compiler-specific macros to provide performance-related hints.
#define OME_ALWAYS_INLINE
Tell the compiler to alway inline a function, regardless of optimization level.
Definition: compiler_hints.h:364
CONSTEXPR uint64_t powerOf10Constant() OME_CONST_FUNCTION OME_ALWAYS_INLINE
Generate compile-time constant for integral power of 10.
Definition: text2int.h:678
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.
Definition: time_point.hpp:681
TimePointCache TimePointCacheForToday OME_INIT_PRIORITY(109)((time_t) 0)
uint64_t convertToCustomEpochUnits(uint64_t desired_granularity=UNITS, const TimePointCache *cachedTimeInfo=&TimePointCacheForToday) const
Convert expanded time to custom units since POSIX epoch.
Definition: time_point.hpp:911
FARGOS CPU tick routines.
struct tm localMidnight
Definition: time_point.hpp:100
int32_t offsetFromUTC() const OME_ALWAYS_INLINE
Definition: time_point.hpp:241
void initializeForDay(const time_t asOfPOSIXepoch)
Initialize a TimePointCache based around a specific point in time.
Definition: time_point.hpp:223
time_t localMidnightEpoch
Definition: time_point.hpp:105
uint64_t getRelativeMicrosecondsInDay() const
Get relative microseconds within a day.
Definition: time_point.hpp:969
TimedMutex tblLock
Definition: time_point.hpp:271
#define CONSTEXPR
Generates constexpr if the compiler supports it.
Definition: compiler_hints.h:432
Convenience class to maintain a table of TimePointCache objects.
Definition: time_point.hpp:269
POSIXtimeInUnits< 1000000000U > POSIXtimeInNanoseconds
Convenience typedef for nanosecond-resolution time.
Definition: time_point.hpp:580
TimePointCache()
Null constructor that does no work.
Definition: time_point.hpp:114
CONSTEXPR unsigned int int_digitsNeeded< 1 >()
\brief Special case for unit precision of 1–no decimal point needed
Definition: time_point.hpp:67