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);
483 typedef Ticks FirstArgType;
542 Nanosecond nanosecond = 0)
546 hour, minute, second, nanosecond)
552 : sinceEpoch_(other.sinceEpoch_)
559 Year year;
Month month; Day day;
561 toDate(sinceEpoch_, year, month, day);
569 Year year;
Month month; Day day;
571 toDate(sinceEpoch_, year, month, day);
579 Year year;
Month month; Day day;
581 toDate(sinceEpoch_, year, month, day);
589 return static_cast<Hour
>(time().hours());
595 return static_cast<Minute
>(time().minutes());
601 return static_cast<Second
>(time().seconds());
607 return static_cast<Millisecond
>(time().milliseconds());
613 return static_cast<Microsecond
>(time().microseconds());
619 return static_cast<Nanosecond
>(time().nanoseconds());
629 TimeTraits::nanosecondsPerDay());
638 TimeTraits::nanosecondsPerDay());
649 sinceEpoch_ = other.sinceEpoch_;
657 std::swap(sinceEpoch_, other.sinceEpoch_);
671 static Ticks toTicks(Year,
Month, Day, Hour, Minute, Second, Nanosecond);
675 static void toDate(Ticks, Year&,
Month&, Day&);
751 timestamp.sinceEpoch() +
762 timestamp.sinceEpoch() -
771 return TimeSpan(left.sinceEpoch() - right.sinceEpoch());
809 toStr(str, timestamp, format);
820 return os <<
toStr(value);
826 return os <<
toStr(value);
840 ts, str.c_str(), str.size());
854 ts, str.c_str(), str.size(), format);
866 throw std::runtime_error(
"Error parsing timestamp.");
880 throw std::runtime_error(
"Error parsing timespan.");
888 return toStr(*
this, format);
894 return toStr(*
this, format);
void toStrAsHHMMSSnsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.sssssssss pattern.
Int32 Hours
Integral type for number of hours.
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Initializes with the given set of values.
static constexpr Int32 microsecondsPerSecond() noexcept
Days days() const noexcept
#define ONIXS_CONFLATEDTCP_LTWT_EXPORTED
void toStrAsYYYYMMDD(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDD format.
static constexpr Int32 nanosecondsPerMicrosecond() noexcept
UInt32 Hour
Integral type presenting the hour component.
#define ONIXS_CONFLATEDTCP_MESSAGING_NAMESPACE_END
void toStrAsYYYYMMDDHHMMSSnsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSnsec format.
Ticks ticks() const noexcept
Timestamp operator+(const Timestamp ×tamp, const TimeSpan &timeSpan) noexcept
Adds te time interval.
#define ONIXS_CONFLATEDTCP_NOTHROW
TimeSpan operator-(const Timestamp &left, const Timestamp &right) noexcept
Calculates the time interval between two time points.
std::ostream & operator<<(std::ostream &os, const TimeSpan &value)
Milliseconds milliseconds() const noexcept
Int32 Days
Integral type for number of days.
Hour hour() const noexcept
void swap(Timestamp &other) noexcept
Exchanges the value.
TimeSpan & operator-=(const TimeSpan &other) noexcept
Subtracts the given time interval.
Minutes minutes() const noexcept
Ticks sinceEpoch() const noexcept
Int32 Seconds
Integral type for number of seconds.
void swap(TimeSpan &other) noexcept
Swaps.
bool operator<=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
#define ONIXS_CONFLATEDTCP_EXPORTED
bool fromStr(Timestamp &ts, const std::string &str, TimestampFormat::Enum format=TimestampFormat::YYYYMMDDHHMMSSnsec)
De-serializes a timestamp from the given string.
bool operator<(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
TimeSpan time() const noexcept
static constexpr Int32 nanosecondsPerMillisecond() noexcept
Microseconds microseconds() const noexcept
Seconds seconds() const noexcept
void toStrAsHHMMSSmsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.sss pattern.
void toStrAsSDHHMMSSnsec(std::string &, TimeSpan)
Serializes the timespan according to the D.HH:MM:SS.sssssssss pattern.
Timestamp(Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
Explicit time-stamp initialization.
bool operator>(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
Int32 Microseconds
Integral type for number of microseconds.
UInt32 Microsecond
Integral type presenting the microsecond component.
static constexpr Int64 nanosecondsPerHour() noexcept
static constexpr Int32 hoursPerDay() noexcept
UInt64 Ticks
Integral type storing internal ticks.
static constexpr Int64 nanosecondsPerMinute() noexcept
void toStrAsYYYYMMDDHHMMSS(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSS format.
size_t toStr(Timestamp, Char *, size_t)
Serializes the timestamp.
#define ONIXS_CONFLATEDTCP_PURE
Nanoseconds nanoseconds() const noexcept
Int64 Ticks
Integral type presenting internal ticks.
bool operator!=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
#define ONIXS_CONFLATEDTCP_CONSTEXPR
#define ONIXS_CONFLATEDTCP_NODISCARD
The time point without the time-zone information.
Nanosecond nanosecond() const noexcept
Timestamp(Ticks ticks=0) noexcept
Initializes from the number of ticks since epoch.
bool operator==(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
void toStrAsHHMMSSpsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.ssssssssssss pattern.
Timestamp & operator=(const Timestamp &other) noexcept
UInt32 Second
Integral type presenting the second component.
OnixS::CME::ConflatedTCP::Messaging::Month::Enum Month
Type presenting the month component.
Int32 Nanoseconds
Integral type for number of nanoseconds.
TimeSpan(Ticks ticks=0) noexcept
Initializes the timespan from the given number of ticks.
void toStrAsYYYYMMDDHHMMSSmsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSmsec format.
Timestamp makeTimestamp(Timestamp::Ticks ticks) noexcept
Make Timestamp helper.
void toStrAsYYYYMMDDHHMMSSusec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSusec format.
void toStrAsYYYYMMDDHHMMSSpsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSpsec format.
bool operator>=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
#define ONIXS_CONFLATEDTCP_LTWT_CLASS
#define ONIXS_CONFLATEDTCP_MESSAGING_NAMESPACE_BEGIN
Millisecond millisecond() const noexcept
static constexpr Int32 secondsPerMinute() noexcept
Minute minute() const noexcept
void toStrAsHHMMSS(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS pattern.
static constexpr Int32 millisecondsPerSecond() noexcept
void toStrAsHHMMSSusec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.ssssss pattern.
static constexpr Int64 nanosecondsPerDay() noexcept
Miscellaneous time characteristics.
Microsecond microsecond() const noexcept
TimeSpan(Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Initializes with the given set of values.
UInt32 Year
Integral type presenting the year component.
static constexpr Int32 minutesPerHour() noexcept
Timestamp(const Timestamp &other) noexcept
TimeSpan & operator+=(const TimeSpan &other) noexcept
Adds the given time interval.
static constexpr Int32 nanosecondsPerSecond() noexcept
Int32 Minutes
Integral type for number of minutes.
Timestamp date() const noexcept
Hours hours() const noexcept
UInt32 Day
Integral type presenting the day component.
#define ONIXS_CONFLATEDTCP_LTWT_STRUCT
UInt32 Minute
Integral type presenting the minute component.
Int32 Milliseconds
Integral type for number of milliseconds.
UInt32 Nanosecond
Integral type presenting the nanosecond component.
UInt32 Millisecond
Integral type presenting the millisecond component.
char Char
Character type alias.
Second second() const noexcept