37 return 86400000000000ll;
44 return 3600000000000ll;
191 numericCast<Ticks>(days) *
192 TimeTraits::nanosecondsPerDay() +
193 numericCast<Ticks>(hours) *
194 TimeTraits::nanosecondsPerHour() +
195 numericCast<Ticks>(minutes) *
196 TimeTraits::nanosecondsPerMinute() +
197 numericCast<Ticks>(seconds) *
198 TimeTraits::nanosecondsPerSecond() +
212 numericCast<Ticks>(hours) *
213 TimeTraits::nanosecondsPerHour() +
214 numericCast<Ticks>(minutes) *
215 TimeTraits::nanosecondsPerMinute() +
216 numericCast<Ticks>(seconds) *
217 TimeTraits::nanosecondsPerSecond() +
228 TimeTraits::nanosecondsPerDay());
239 TimeTraits::nanosecondsPerHour()) %
240 TimeTraits::hoursPerDay()
250 numericCast<Minutes>(
252 TimeTraits::nanosecondsPerMinute()) %
253 TimeTraits::minutesPerHour()
263 numericCast<Seconds>(
265 TimeTraits::nanosecondsPerSecond()) %
266 TimeTraits::secondsPerMinute()
276 numericCast<Milliseconds>
278 TimeTraits::nanosecondsPerMillisecond()) %
279 TimeTraits::millisecondsPerSecond()
289 numericCast<Microseconds>
291 TimeTraits::nanosecondsPerMicrosecond()) %
292 TimeTraits::microsecondsPerSecond()
302 numericCast<Nanoseconds>
304 TimeTraits::nanosecondsPerSecond());
319 ticks_ += other.ticks_;
327 ticks_ -= other.ticks_;
335 std::swap(ticks_, other.ticks_);
351 return left.ticks() == right.ticks();
358 return left.ticks() != right.ticks();
365 return left.ticks() < right.ticks();
372 return left.ticks() > right.ticks();
416 toStr(str, timeSpan, format);
522 Nanosecond nanosecond = 0)
526 hour, minute, second, nanosecond)
532 : sinceEpoch_(other.sinceEpoch_)
539 Year year;
Month month; Day day;
541 toDate(sinceEpoch_, year, month, day);
549 Year year;
Month month; Day day;
551 toDate(sinceEpoch_, year, month, day);
559 Year year;
Month month; Day day;
561 toDate(sinceEpoch_, year, month, day);
569 return static_cast<Hour
>(time().hours());
575 return static_cast<Minute
>(time().minutes());
581 return static_cast<Second
>(time().seconds());
587 return static_cast<Millisecond
>(time().milliseconds());
593 return static_cast<Microsecond
>(time().microseconds());
599 return static_cast<Nanosecond
>(time().nanoseconds());
609 TimeTraits::nanosecondsPerDay());
618 TimeTraits::nanosecondsPerDay());
629 sinceEpoch_ = other.sinceEpoch_;
637 std::swap(sinceEpoch_, other.sinceEpoch_);
651 static Ticks toTicks(Year,
Month, Day, Hour, Minute, Second, Nanosecond);
655 static void toDate(Ticks, Year&,
Month&, Day&);
731 timestamp.sinceEpoch() +
742 timestamp.sinceEpoch() -
751 return TimeSpan(left.sinceEpoch() - right.sinceEpoch());
789 toStr(str, timestamp, format);
800 return os <<
toStr(value);
806 return os <<
toStr(value);
820 ts, str.c_str(), str.size());
834 ts, str.c_str(), str.size(), format);
846 throw std::runtime_error(
"Error parsing timestamp.");
860 throw std::runtime_error(
"Error parsing timespan.");
868 return toStr(*
this, format);
874 return toStr(*
this, format);
#define ONIXS_ILINK3_CONSTEXPR
void toStrAsHHMMSS(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS pattern.
TimeSpan & operator+=(const TimeSpan &other) noexcept
Adds the given time interval.
Timestamp(const Timestamp &other) noexcept
static constexpr Int32 minutesPerHour() noexcept
static constexpr Int32 millisecondsPerSecond() noexcept
Days days() const noexcept
static constexpr Int32 hoursPerDay() noexcept
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Initializes with the given set of values.
TimeSpan & operator-=(const TimeSpan &other) noexcept
Subtracts the given time interval.
Timestamp makeTimestamp(Timestamp::Ticks ticks) noexcept
Make Timestamp helper.
TimeSpan(Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Initializes with the given set of values.
char Char
Character type alias.
UInt32 Nanosecond
Integral type presenting the nanosecond component.
Int32 Days
Integral type for number of days.
void toStrAsHHMMSSmsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.sss pattern.
Hour hour() const noexcept
Int32 Nanoseconds
Integral type for number of nanoseconds.
#define ONIXS_ILINK3_PURE
static constexpr Int32 nanosecondsPerMillisecond() noexcept
static constexpr Int64 nanosecondsPerMinute() noexcept
Second second() const noexcept
UInt32 Hour
Integral type presenting the hour component.
void swap(TimeSpan &other) noexcept
Swaps.
bool operator>=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
Int32 Milliseconds
Integral type for number of milliseconds.
Timestamp date() const noexcept
UInt32 Second
Integral type presenting the second component.
Timestamp(Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
Explicit time-stamp initialization.
UInt64 Ticks
Integral type storing internal ticks.
Int32 Microseconds
Integral type for number of microseconds.
bool fromStr(Timestamp &ts, const std::string &str, TimestampFormat::Enum format=TimestampFormat::YYYYMMDDHHMMSSnsec)
De-serializes a timestamp from the given string.
Ticks ticks() const noexcept
Seconds seconds() const noexcept
Minute minute() const noexcept
Ticks sinceEpoch() const noexcept
static constexpr Int64 nanosecondsPerHour() noexcept
bool operator<=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
static constexpr Int32 secondsPerMinute() noexcept
Hours hours() const noexcept
void toStrAsYYYYMMDDHHMMSSnsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSnsec format.
#define ONIXS_ILINK3_LTWT_EXPORTED
void toStrAsYYYYMMDDHHMMSSusec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSusec format.
Int32 Seconds
Integral type for number of seconds.
static constexpr Int32 nanosecondsPerMicrosecond() noexcept
Millisecond millisecond() const noexcept
UInt32 Day
Integral type presenting the day component.
#define ONIXS_ILINK3_LTWT_CLASS
OnixS::CME::iLink3::Messaging::Month::Enum Month
Type presenting the month component.
Int32 Hours
Integral type for number of hours.
std::ostream & operator<<(std::ostream &os, const TimeSpan &value)
void toStrAsYYYYMMDDHHMMSSpsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSpsec format.
Int64 Ticks
Integral type presenting internal ticks.
void toStrAsYYYYMMDDHHMMSSmsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSmsec format.
void toStrAsHHMMSSnsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.sssssssss pattern.
bool operator!=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
void toStrAsYYYYMMDDHHMMSS(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSS format.
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
UInt32 Year
Integral type presenting the year component.
#define ONIXS_ILINK3_EXPORTED
bool operator==(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
void swap(Timestamp &other) noexcept
Exchanges the value.
Milliseconds milliseconds() const noexcept
static constexpr Int32 microsecondsPerSecond() noexcept
size_t toStr(Timestamp, Char *, size_t)
Serializes the timestamp.
UInt32 Millisecond
Integral type presenting the millisecond component.
Microsecond microsecond() const noexcept
Miscellaneous time characteristics.
static constexpr Int64 nanosecondsPerDay() noexcept
Int32 Minutes
Integral type for number of minutes.
UInt32 Microsecond
Integral type presenting the microsecond component.
Nanoseconds nanoseconds() const noexcept
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
static constexpr Int32 nanosecondsPerSecond() noexcept
Minutes minutes() const noexcept
void toStrAsSDHHMMSSnsec(std::string &, TimeSpan)
Serializes the timespan according to the D.HH:MM:SS.sssssssss pattern.
Nanosecond nanosecond() const noexcept
TimeSpan time() const noexcept
bool operator<(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
The time point without the time-zone information.
UInt32 Minute
Integral type presenting the minute component.
TimeSpan operator-(const Timestamp &left, const Timestamp &right) noexcept
Calculates the time interval between two time points.
TimeSpan(Ticks ticks=0) noexcept
Initializes the timespan from the given number of ticks.
Microseconds microseconds() const noexcept
bool operator>(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
void toStrAsHHMMSSusec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.ssssss pattern.
void toStrAsYYYYMMDD(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDD format.
#define ONIXS_ILINK3_NODISCARD
void toStrAsHHMMSSpsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.ssssssssssss pattern.
Timestamp(Ticks ticks=0) noexcept
Initializes from the number of ticks since epoch.
#define ONIXS_ILINK3_NOTHROW
#define ONIXS_ILINK3_LTWT_STRUCT
Timestamp & operator=(const Timestamp &other) noexcept
Timestamp operator+(const Timestamp ×tamp, const TimeSpan &timeSpan) noexcept
Adds the time interval.