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