OnixS C++ Cboe CFE Multicast PITCH Market Data Handler  1.12.1
API documentation
Time.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 #pragma once
21 
22 #include <string>
23 #include <algorithm>
24 #include <stdexcept>
25 
29 
30 
31 namespace OnixS
32 {
33  namespace CboeCFE
34  {
35  namespace MarketData
36  {
37  namespace Pitch
38  {
39  /// Miscellaneous time characteristics.
40  struct TimeTraits
41  {
42  /// Returns number of nanoseconds in single day.
44  static Int64 nanosecondsPerDay()
45  {
46  return 86400000000000ll;
47  }
48 
49  /// Returns number of nanoseconds in single hour.
51  static Int64 nanosecondsPerHour()
52  {
53  return 3600000000000ll;
54  }
55 
56  /// Returns number of nanoseconds in single minute.
58  static Int64 nanosecondsPerMinute()
59  {
60  return 60000000000ll;
61  }
62 
63  /// Returns number of nanoseconds in single second.
65  static Int32 nanosecondsPerSecond()
66  {
67  return 1000000000;
68  }
69 
70  /// Returns number of nanoseconds in single millisecond.
73  {
74  return 1000000;
75  }
76 
77  /// Returns number of nanoseconds in single microsecond.
80  {
81  return 1000;
82  }
83 
84  /// Returns number of hours in single day.
86  static Int32 hoursPerDay()
87  {
88  return 24;
89  }
90 
91  /// Returns number of minutes in single hour.
93  static Int32 minutesPerHour()
94  {
95  return 60;
96  }
97 
98  /// Returns number of seconds in single minute.
100  static Int32 secondsPerMinute()
101  {
102  return 60;
103  }
104 
105  /// Returns number of milliseconds in single second.
107  static Int32 millisecondsPerSecond()
108  {
109  return 1000;
110  }
111 
112  /// Returns number of microseconds in single second.
114  static Int32 microsecondsPerSecond()
115  {
116  return 1000000;
117  }
118  };
119 
120  /// Represents time interval. Used primarily to present time-only
121  /// stamps and to measure time intervals between two timestamps.
122  class TimeSpan
123  {
124  public:
125  /// Integral type presenting internal ticks.
126  typedef Int64 Ticks;
127 
128  /// Integral type for number of days.
129  typedef Int32 Days;
130 
131  /// Integral type for number of hours.
132  typedef Int32 Hours;
133 
134  /// Integral type for number of minutes.
135  typedef Int32 Minutes;
136 
137  /// Integral type for number of seconds.
138  typedef Int32 Seconds;
139 
140  /// Integral type for number of milliseconds.
141  typedef Int32 Milliseconds;
142 
143  /// Integral type for number of microseconds.
144  typedef Int32 Microseconds;
145 
146  /// Integral type for number of nanoseconds.
147  typedef Int32 Nanoseconds;
148 
149  /// Initializes timespan from given number of ticks.
150  explicit TimeSpan(Ticks ticks = 0) ONIXS_BATS_PITCH_NOTHROW
151  : ticks_(ticks)
152  {
153  }
154 
155  /// Initializes with given set of values.
156  ///
157  /// Input parameters are treated as quantities,
158  /// but not as a time stamp. Therefore, there's
159  /// no requirement to fit in a certain range like
160  /// hours must fit into [0, 24) range. After
161  /// initialization time span will be normalized.
163  Days days,
164  Hours hours,
165  Minutes minutes,
166  Seconds seconds,
167  Nanoseconds nanoseconds)
168  : ticks_(
169  static_cast<Ticks>(days) *
171  static_cast<Ticks>(hours) *
173  static_cast<Ticks>(minutes) *
175  static_cast<Ticks>(seconds) *
177  nanoseconds)
178  {
179  }
180 
181  /// Initializes with given set of values.
182  ///
183  /// Input parameters are treated as quantities,
184  /// but not as a time stamp. Therefore, there's
185  /// no requirement to fit in a certain range like
186  /// hours must fit into [0, 24) range. After
187  /// initialization time span will be normalized.
189  Hours hours,
190  Minutes minutes,
191  Seconds seconds,
192  Nanoseconds nanoseconds)
193  : ticks_(
194  static_cast<Ticks>(hours) *
196  static_cast<Ticks>(minutes) *
198  static_cast<Ticks>(seconds) *
200  nanoseconds)
201  {
202  }
203 
204  /// Days component of time interval.
205  /// Whole number of days in time interval.
206  Days days() const
207  {
208  return
209  static_cast<Days>
210  (ticks_ /
212  }
213 
214  /// Hours component of time interval.
215  /// Values are in range from -23 through 23.
216  Hours hours() const
217  {
218  return
219  static_cast<Hours>(
220  (ticks_ /
223  );
224  }
225 
226  /// Minutes component of time interval.
227  /// Values are in range from -59 through 59.
228  Int32 minutes() const
229  {
230  return
231  static_cast<Minutes>(
232  (ticks_ /
235  );
236  }
237 
238  /// Seconds component of time interval.
239  /// Values are in range from -59 through 59.
240  Int32 seconds() const
241  {
242  return
243  static_cast<Seconds>(
244  (ticks_ /
247  );
248  }
249 
250  /// Milliseconds component of time interval.
251  /// Values are in range from -999 through 999.
252  Milliseconds milliseconds() const
253  {
254  return
255  static_cast<Milliseconds>
256  ((ticks_ /
259  );
260  }
261 
262  /// Microseconds component of time interval.
263  /// Values are in range from -999999 through 999999.
264  Microseconds microseconds() const
265  {
266  return
267  static_cast<Microseconds>
268  ((ticks_ /
271  );
272  }
273 
274  /// Nanoseconds component of time interval.
275  /// Values are in range from -999999999 through 999999999.
276  Nanoseconds nanoseconds() const
277  {
278  return
279  static_cast<Nanoseconds>
280  (ticks_ %
282  }
283 
284  /// Number of ticks in given time interval.
285  ///
286  /// Ticks are the lowest time quantity used
287  /// to measure time intervals. In current
288  /// implementation ticks are nanoseconds.
289  Ticks ticks() const
290  {
291  return ticks_;
292  }
293 
294  /// Adds time interval to current one.
295  TimeSpan&
296  operator +=(
297  const TimeSpan& other)
298  {
299  ticks_ += other.ticks_;
300  return *this;
301  }
302 
303  /// Subtracts time interval from current one.
304  TimeSpan&
305  operator -=(
306  const TimeSpan& other)
307  {
308  ticks_ -= other.ticks_;
309  return *this;
310  }
311 
312  /// Exchanges with given instance.
313  void
314  swap(TimeSpan& other)
316  {
317  std::swap(ticks_, other.ticks_);
318  }
319 
320  private:
321  Ticks ticks_;
322  };
323 
324  /// Compares with other instance for equality.
325  inline
326  bool
328  const TimeSpan& left,
329  const TimeSpan& right)
330  {
331  return left.ticks() == right.ticks();
332  }
333 
334  /// Compares with other instance for in-equality.
335  inline
336  bool
338  const TimeSpan& left,
339  const TimeSpan& right)
340  {
341  return left.ticks() != right.ticks();
342  }
343 
344  /// Checks whether left time interval less than right one.
345  inline
346  bool
348  const TimeSpan& left,
349  const TimeSpan& right)
350  {
351  return left.ticks() < right.ticks();
352  }
353 
354  /// Checks whether left time interval greater than right one.
355  inline
356  bool
358  const TimeSpan& left,
359  const TimeSpan& right)
360  {
361  return left.ticks() > right.ticks();
362  }
363 
364  // TimeSpan serialization.
365 
366  // Serializes timespan according to HH:MM:SS pattern.
367  ONIXS_CBOECFE_PITCH_API
368  void
369  toStrAsHHMMSS(std::string&, TimeSpan);
370 
371  // Serializes timespan according to HH:MM:SS.sss pattern.
372  ONIXS_CBOECFE_PITCH_API
373  void
374  toStrAsHHMMSSmsec(std::string&, TimeSpan);
375 
376  // Serializes timespan according to D.HH:MM:SS.sssssssss pattern.
377  ONIXS_CBOECFE_PITCH_API
378  void
379  toStrAsSDHHMMSSnsec(std::string&, TimeSpan);
380 
381  /// Collection of timespan formatting patterns.
383  {
384  enum Enum
385  {
386  /// HH:MM:SS.
388 
389  /// HH:MM:SS.sss.
391 
392  /// D.HH:MM:SS.sssssssss.
393  SDHHMMSSnsec
394  };
395  };
396 
397 
398  /// Appends timespan formatted in specified pattern to given string.
399  inline
400  void toStr(
401  std::string& str,
402  TimeSpan timeSpan,
403  TimeSpanFormat::Enum format =
405  {
406  switch (format)
407  {
409  toStrAsHHMMSS(str, timeSpan);
410  break;
411 
413  toStrAsHHMMSSmsec(str, timeSpan);
414  break;
415 
417  toStrAsSDHHMMSSnsec(str, timeSpan);
418  break;
419 
420  default:
421  {
422  throw std::invalid_argument(
423  "Unknown timespan format pattern specified. ");
424  }
425  }
426  }
427 
428  /// Formats timespan according to specified pattern.
429  inline
430  std::string toStr(
431  TimeSpan timeSpan,
432  TimeSpanFormat::Enum format =
434  {
435  std::string str;
436 
437  toStr(str, timeSpan, format);
438 
439  return str;
440  }
441 
442  /// Identifies months in year.
443  struct Month
444  {
445  enum Enum
446  {
447  January = 1,
458  December
459  };
460  };
461 
462  /// Collection of timestamp formatting patterns.
464  {
465  enum Enum
466  {
467  /// YYYYMMDD.
469 
470  /// YYYYMMDD-HH:MM:SS.
472 
473  /// YYYYMMDD-HH:MM:SS.sss.
475 
476  /// YYYYMMDD-HH:MM:SS.sssssssss.
477  YYYYMMDDHHMMSSnsec
478  };
479  };
480 
481  /// Represents time point without time-zone information.
482  class Timestamp
483  {
484  public:
485  /// Integral type storing internal ticks.
486  typedef UInt64 Ticks;
487 
488  /// Integral type presenting year component.
489  typedef UInt32 Year;
490 
491  /// Type presenting month component.
492  typedef
495 
496  /// Integral type presenting day component.
497  typedef UInt32 Day;
498 
499  /// Integral type presenting hour component.
500  typedef UInt32 Hour;
501 
502  /// Integral type presenting minute component.
503  typedef UInt32 Minute;
504 
505  /// Integral type presenting second component.
506  typedef UInt32 Second;
507 
508  /// Integral type presenting millisecond component.
509  typedef UInt32 Millisecond;
510 
511  /// Integral type presenting microsecond component.
512  typedef UInt32 Microsecond;
513 
514  /// Integral type presenting nanosecond component.
515  typedef UInt32 Nanosecond;
516 
517  /// Returns current UTC time.
518  ONIXS_CBOECFE_PITCH_API
519  static
520  Timestamp utcNow();
521 
522  /// Returns current local time.
523  ONIXS_CBOECFE_PITCH_API
524  static
525  Timestamp now();
526 
527  /// Initializes from number of ticks since epoch.
528  explicit
530  Ticks ticks = 0) ONIXS_BATS_PITCH_NOTHROW
531  : sinceEpoch_(ticks)
532  {
533  }
534 
535  /// Explicit time-stamp initialization.
536  ///
537  /// Input parameters are validated, therefore
538  /// constructor throws exception if input values
539  /// do not fit into their valid ranges.
541  Year year,
542  Month month,
543  Day day,
544  Hour hour = 0,
545  Minute minute = 0,
546  Second second = 0,
547  Nanosecond nanosecond = 0)
548  : sinceEpoch_(
549  toTicks(
550  year, month, day,
551  hour, minute, second, nanosecond)
552  )
553  {
554  }
555 
556  /// Initializes as copy of other instance.
558  const Timestamp& other)
559  : sinceEpoch_(other.sinceEpoch_)
560  {
561  }
562 
563  /// Year component of given time point.
564  Year year() const
565  {
566  Year year; Month month; Day day;
567 
568  toDate(sinceEpoch_, year, month, day);
569 
570  return year;
571  }
572 
573  /// Month component of given time point.
574  Month month() const
575  {
576  Year year; Month month; Day day;
577 
578  toDate(sinceEpoch_, year, month, day);
579 
580  return month;
581  }
582 
583  /// Day component of given time point.
584  Day day() const
585  {
586  Year year; Month month; Day day;
587 
588  toDate(sinceEpoch_, year, month, day);
589 
590  return day;
591  }
592 
593  /// Hour component of given time point.
594  Hour hour() const
595  {
596  return static_cast<Hour>(time().hours());
597  }
598 
599  /// Minute component of given time point.
600  Minute minute() const
601  {
602  return static_cast<Minute>(time().minutes());
603  }
604 
605  /// Second component of given time point.
606  Second second() const
607  {
608  return static_cast<Second>(time().seconds());
609  }
610 
611  /// Millisecond component of given time point.
612  Millisecond millisecond() const
613  {
614  return static_cast<Millisecond>(time().milliseconds());
615  }
616 
617  /// Microsecond component of given time point.
618  Microsecond microsecond() const
619  {
620  return static_cast<Microsecond>(time().microseconds());
621  }
622 
623  /// Nanosecond component of given time point.
624  Nanosecond nanosecond() const
625  {
626  return static_cast<Nanosecond>(time().nanoseconds());
627  }
628 
629  /// Timestamp without a time part.
630  Timestamp date() const
631  {
632  return
633  Timestamp(
634  sinceEpoch_ -
635  sinceEpoch_ %
637  }
638 
639  /// Time part of timestamp.
640  TimeSpan time() const
641  {
642  return
643  TimeSpan(
644  sinceEpoch_ %
646  }
647 
648  /// Number of nanoseconds since the Epoch (01-01-1970).
649  Ticks sinceEpoch() const
651  {
652  return sinceEpoch_;
653  }
654 
655  /// Reinitializes as copy of given instance.
656  Timestamp&
657  operator =(
658  const Timestamp& other)
659  {
660  sinceEpoch_ = other.sinceEpoch_;
661 
662  return *this;
663  }
664 
665  /// Exchanges value with other instance.
666  void
668  Timestamp& other)
669  {
670  std::swap(
671  sinceEpoch_,
672  other.sinceEpoch_);
673  }
674 
675  /// Parses timestamp from its numeric presentation (like 20201115)
676  /// only YYYYMMDD is supported
677  static
678  Timestamp
679  parse (
680  unsigned long long presentation,
682 
683  private:
684  // Time interval in nanoseconds since the 01-01-1970.
685  Ticks sinceEpoch_;
686 
687  // Converts structured date-time into ticks.
688  ONIXS_CBOECFE_PITCH_API
689  static
690  Ticks toTicks(
691  Year, Month, Day,
692  Hour, Minute, Second,
693  Nanosecond);
694 
695  // Extracts date components from ticks.
696  ONIXS_CBOECFE_PITCH_API
697  static
698  void toDate(Ticks, Year&, Month&, Day&);
699  };
700 
701  /// Create Timestamp from whole seconds since the Epoch
702  inline
703  Timestamp fromSeconds(UInt32 secondsSinceEpoch)
704  {
705  return Timestamp(
706  static_cast<Timestamp::Ticks>(
707  secondsSinceEpoch) * TimeTraits::nanosecondsPerSecond());
708  }
709 
710  /// Compares with instances for equality.
711  inline
712  bool
714  const Timestamp& left,
715  const Timestamp& right)
716  {
717  return (
718  left.sinceEpoch() ==
719  right.sinceEpoch()
720  );
721  }
722 
723  /// Compares with instances for inequality.
724  inline
725  bool
727  const Timestamp& left,
728  const Timestamp& right)
729  {
730  return (
731  left.sinceEpoch() !=
732  right.sinceEpoch()
733  );
734  }
735 
736  /// Establishes order between two instances.
737  inline
738  bool
740  const Timestamp& left,
741  const Timestamp& right)
742  {
743  return (
744  left.sinceEpoch() <
745  right.sinceEpoch()
746  );
747  }
748 
749  /// Establishes order between two instances.
750  inline
751  bool
753  const Timestamp& left,
754  const Timestamp& right)
755  {
756  return (
757  left.sinceEpoch() <=
758  right.sinceEpoch()
759  );
760  }
761 
762  /// Establishes order between two instances.
763  inline
764  bool
766  const Timestamp& left,
767  const Timestamp& right)
768  {
769  return (
770  left.sinceEpoch() >
771  right.sinceEpoch()
772  );
773  }
774 
775  /// Establishes order between two instances.
776  inline
777  bool
779  const Timestamp& left,
780  const Timestamp& right)
781  {
782  return (
783  left.sinceEpoch() >=
784  right.sinceEpoch()
785  );
786  }
787 
788  /// Adds time interval to given time point.
789  inline
790  Timestamp
792  const Timestamp& timestamp,
793  const TimeSpan& timeSpan)
794  {
795  return
796  Timestamp(
797  timestamp.sinceEpoch() +
798  timeSpan.ticks()
799  );
800  }
801 
802  /// Subtracts time interval from given time point.
803  inline
804  Timestamp
806  const Timestamp& timestamp,
807  const TimeSpan& timeSpan)
808  {
809  return
810  Timestamp(
811  timestamp.sinceEpoch() -
812  timeSpan.ticks()
813  );
814  }
815 
816  /// Calculates time interval between two time points.
817  inline
818  TimeSpan
820  const Timestamp& left,
821  const Timestamp& right)
822  {
823  return
824  TimeSpan(
825  left.sinceEpoch() -
826  right.sinceEpoch()
827  );
828  }
829 
830  // Serialization.
831 
832  /// Serializes timestamp in YYYYMMDD format.
833  ONIXS_CBOECFE_PITCH_API
834  void
836  (
837  std::string&,
838  Timestamp
839  );
840 
841  /// Serializes timestamp in YYYYMMDDHHMMSS format.
842  ONIXS_CBOECFE_PITCH_API
843  void
845  (
846  std::string&,
847  Timestamp
848  );
849 
850  /// Serializes timestamp in YYYYMMDDHHMMSSmsec format.
851  ONIXS_CBOECFE_PITCH_API
852  void
854  (
855  std::string&,
856  Timestamp
857  );
858 
859  /// Serializes timestamp in YYYYMMDDHHMMSSnsec format.
860  ONIXS_CBOECFE_PITCH_API
861  void
863  (
864  std::string&,
865  Timestamp
866  );
867 
868  /// Serializes timestamp according to specified pattern.
869  ONIXS_CBOECFE_PITCH_API
870  void
871  toStr(
872  std::string& str,
873  Timestamp timestamp,
874  TimestampFormat::Enum format =
876 
877  /// Serializes timestamp according to specified pattern.
878  inline
879  std::string
881  Timestamp timestamp,
882  TimestampFormat::Enum format =
884  {
885  std::string str;
886 
887  toStr(str, timestamp, format);
888 
889  return str;
890  }
891 
892  /// De-serializes a timestamp from the given string.
893  ONIXS_CBOECFE_PITCH_API
894  bool
895  fromStr(
896  Timestamp&,
897  const char*,
898  size_t);
899 
900  inline
901  bool
903  Timestamp& ts,
904  const std::string& str)
905  {
906  return
907  fromStr(
908  ts, str.c_str(), str.size());
909  }
910 
911 
912 
913 
914  }
915  }
916  }
917 }
Millisecond millisecond() const
Millisecond component of given time point.
Definition: Time.h:612
bool operator>(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:144
UInt32 Day
Integral type presenting day component.
Definition: Time.h:497
Nanoseconds nanoseconds() const
Definition: Time.h:276
Year year() const
Year component of given time point.
Definition: Time.h:564
Collection of timespan formatting patterns.
Definition: Time.h:382
static ONIXS_BATS_PITCH_CONSTEXPR Int32 hoursPerDay()
Returns number of hours in single day.
Definition: Time.h:86
Int32 Microseconds
Integral type for number of microseconds.
Definition: Time.h:144
UInt32 Nanosecond
Integral type presenting nanosecond component.
Definition: Time.h:515
Minute minute() const
Minute component of given time point.
Definition: Time.h:600
Timestamp date() const
Timestamp without a time part.
Definition: Time.h:630
static ONIXS_BATS_PITCH_CONSTEXPR Int64 nanosecondsPerHour()
Returns number of nanoseconds in single hour.
Definition: Time.h:51
bool operator!=(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:126
bool operator<=(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:153
Timestamp operator+(const Timestamp &timestamp, const TimeSpan &timeSpan)
Adds time interval to given time point.
Definition: Time.h:791
ONIXS_CBOECFE_PITCH_API void toStrAsYYYYMMDD(std::string &, Timestamp)
Serializes timestamp in YYYYMMDD format.
static ONIXS_BATS_PITCH_CONSTEXPR Int64 nanosecondsPerMinute()
Returns number of nanoseconds in single minute.
Definition: Time.h:58
TimeSpan(Ticks ticks=0) ONIXS_BATS_PITCH_NOTHROW
Initializes timespan from given number of ticks.
Definition: Time.h:150
static ONIXS_BATS_PITCH_CONSTEXPR Int32 microsecondsPerSecond()
Returns number of microseconds in single second.
Definition: Time.h:114
Microsecond microsecond() const
Microsecond component of given time point.
Definition: Time.h:618
UInt64 Ticks
Integral type storing internal ticks.
Definition: Time.h:486
Day day() const
Day component of given time point.
Definition: Time.h:584
static ONIXS_BATS_PITCH_CONSTEXPR Int32 millisecondsPerSecond()
Returns number of milliseconds in single second.
Definition: Time.h:107
Int64 Ticks
Integral type presenting internal ticks.
Definition: Time.h:126
UInt32 Microsecond
Integral type presenting microsecond component.
Definition: Time.h:512
static ONIXS_BATS_PITCH_CONSTEXPR Int32 secondsPerMinute()
Returns number of seconds in single minute.
Definition: Time.h:100
static ONIXS_BATS_PITCH_CONSTEXPR Int32 minutesPerHour()
Returns number of minutes in single hour.
Definition: Time.h:93
bool operator>=(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:162
Timestamp fromSeconds(UInt32 secondsSinceEpoch)
Create Timestamp from whole seconds since the Epoch.
Definition: Time.h:703
Miscellaneous time characteristics.
Definition: Time.h:40
Month month() const
Month component of given time point.
Definition: Time.h:574
static ONIXS_BATS_PITCH_CONSTEXPR Int32 nanosecondsPerMillisecond()
Returns number of nanoseconds in single millisecond.
Definition: Time.h:72
Int32 Seconds
Integral type for number of seconds.
Definition: Time.h:138
ONIXS_CBOECFE_PITCH_API void toStrAsHHMMSS(std::string &, TimeSpan)
UInt32 Minute
Integral type presenting minute component.
Definition: Time.h:503
Second second() const
Second component of given time point.
Definition: Time.h:606
Collection of timestamp formatting patterns.
Definition: Time.h:463
#define ONIXS_BATS_PITCH_CONSTEXPR
Definition: Compiler.h:113
Identifies months in year.
Definition: Time.h:443
void swap(Timestamp &other)
Exchanges value with other instance.
Definition: Time.h:667
bool operator<(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition: Decimal.h:135
UInt32 Year
Integral type presenting year component.
Definition: Time.h:489
static ONIXS_BATS_PITCH_CONSTEXPR Int64 nanosecondsPerDay()
Returns number of nanoseconds in single day.
Definition: Time.h:44
static ONIXS_BATS_PITCH_CONSTEXPR Int32 nanosecondsPerMicrosecond()
Returns number of nanoseconds in single microsecond.
Definition: Time.h:79
Int32 Hours
Integral type for number of hours.
Definition: Time.h:132
ONIXS_CBOECFE_PITCH_API void toStrAsYYYYMMDDHHMMSS(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSS format.
TimeSpan time() const
Time part of timestamp.
Definition: Time.h:640
ONIXS_CBOECFE_PITCH_API void toStrAsYYYYMMDDHHMMSSnsec(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSSnsec format.
Int32 Milliseconds
Integral type for number of milliseconds.
Definition: Time.h:141
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
Definition: Time.h:162
bool operator==(const PriceLevel &l, const PriceLevel &r) ONIXS_BATS_PITCH_NOTHROW
compare
Definition: OrderBook.h:327
Ticks sinceEpoch() const ONIXS_BATS_PITCH_NOTHROW
Number of nanoseconds since the Epoch (01-01-1970).
Definition: Time.h:649
UInt32 Hour
Integral type presenting hour component.
Definition: Time.h:500
OnixS::CboeCFE::MarketData::Pitch::Month::Enum Month
Type presenting month component.
Definition: Time.h:494
Timestamp(Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
Definition: Time.h:540
UInt32 Millisecond
Integral type presenting millisecond component.
Definition: Time.h:509
Nanosecond nanosecond() const
Nanosecond component of given time point.
Definition: Time.h:624
void swap(TimeSpan &other) ONIXS_BATS_PITCH_NOTHROW
Exchanges with given instance.
Definition: Time.h:314
Int32 Nanoseconds
Integral type for number of nanoseconds.
Definition: Time.h:147
#define ONIXS_BATS_PITCH_NOTHROW
Definition: Compiler.h:107
Timestamp(const Timestamp &other)
Initializes as copy of other instance.
Definition: Time.h:557
static ONIXS_BATS_PITCH_CONSTEXPR Int32 nanosecondsPerSecond()
Returns number of nanoseconds in single second.
Definition: Time.h:65
Represents time point without time-zone information.
Definition: Time.h:482
Timestamp operator-(const Timestamp &timestamp, const TimeSpan &timeSpan)
Subtracts time interval from given time point.
Definition: Time.h:805
ONIXS_CBOECFE_PITCH_API void toStrAsHHMMSSmsec(std::string &, TimeSpan)
UInt32 Second
Integral type presenting second component.
Definition: Time.h:506
ONIXS_CBOECFE_PITCH_API void toStrAsYYYYMMDDHHMMSSmsec(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSSmsec format.
ONIXS_CBOECFE_PITCH_API void toStr(std::string &, SideIndicator::Enum)
Appends string presentation of object.
Milliseconds milliseconds() const
Definition: Time.h:252
Int32 Minutes
Integral type for number of minutes.
Definition: Time.h:135
ONIXS_CBOECFE_PITCH_API bool fromStr(Timestamp &, const char *, size_t)
De-serializes a timestamp from the given string.
ONIXS_CBOECFE_PITCH_API void toStrAsSDHHMMSSnsec(std::string &, TimeSpan)
Hour hour() const
Hour component of given time point.
Definition: Time.h:594
Int32 Days
Integral type for number of days.
Definition: Time.h:129
Timestamp(Ticks ticks=0) ONIXS_BATS_PITCH_NOTHROW
Initializes from number of ticks since epoch.
Definition: Time.h:529
TimeSpan(Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
Definition: Time.h:188
Microseconds microseconds() const
Definition: Time.h:264