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