OnixS C++ CME MDP Streamlined Market Data Handler  1.2.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 
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  /// Exchanges with given instance.
297  void
298  swap(TimeSpan& other)
299  {
300  std::swap(ticks_, other.ticks_);
301  }
302 
303 private:
304  Ticks ticks_;
305 };
306 
307 /// Compares with other instance for equality.
308 inline
309 bool
311  const TimeSpan& left,
312  const TimeSpan& right)
313 {
314  return left.ticks() == right.ticks();
315 }
316 
317 /// Compares with other instance for in-equality.
318 inline
319 bool
321  const TimeSpan& left,
322  const TimeSpan& right)
323 {
324  return left.ticks() != right.ticks();
325 }
326 
327 /// Checks whether left time interval less than right one.
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 greater 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 // TimeSpan serialization.
348 
349 // Serializes timespan according to HH:MM:SS pattern.
351 void
352 toStrAsHHMMSS(std::string&, TimeSpan);
353 
354 // Serializes timespan according to HH:MM:SS.sss pattern.
356 void
357 toStrAsHHMMSSmsec(std::string&, TimeSpan);
358 
359 // Serializes timespan according to D.HH:MM:SS.sssssssss pattern.
361 void
362 toStrAsSDHHMMSSnsec(std::string&, TimeSpan);
363 
364 /// Collection of timespan formatting patterns.
366 {
367  enum Enum
368  {
369  /// HH:MM:SS.
371 
372  /// HH:MM:SS.sss.
374 
375  /// D.HH:MM:SS.sssssssss.
376  SDHHMMSSnsec
377  };
378 };
379 
380 /// Appends timespan formatted in specified pattern to given string.
381 inline
382 void
384  std::string& str,
385  TimeSpan timeSpan,
386  TimeSpanFormat::Enum format =
387  TimeSpanFormat::SDHHMMSSnsec)
388 {
389  switch (format)
390  {
391  case TimeSpanFormat::HHMMSS:
392  toStrAsHHMMSS(str, timeSpan);
393  break;
394 
395  case TimeSpanFormat::HHMMSSmsec:
396  toStrAsHHMMSSmsec(str, timeSpan);
397  break;
398 
399  case TimeSpanFormat::SDHHMMSSnsec:
400  toStrAsSDHHMMSSnsec(str, timeSpan);
401  break;
402 
403  default:
404  {
405  throw std::invalid_argument(
406  "Unknown timespan format pattern specified. ");
407  }
408  }
409 }
410 
411 /// Formats timespan according to specified pattern.
412 inline
413 std::string
415  TimeSpan timeSpan,
416  TimeSpanFormat::Enum format =
417  TimeSpanFormat::SDHHMMSSnsec)
418 {
419  std::string str;
420 
421  toStr(str, timeSpan, format);
422 
423  return str;
424 }
425 
426 /// Identifies months in year.
428 {
429  enum Enum
430  {
431  January = 1,
442  December
443  };
444 };
445 
446 /// Represents time point without time-zone information.
448 {
449 public:
450  /// Integral type storing internal ticks.
451  typedef UInt64 Ticks;
452 
453  /// Integral type presenting year component.
454  typedef UInt32 Year;
455 
456  /// Type presenting month component.
457  typedef
460 
461  /// Integral type presenting day component.
462  typedef UInt32 Day;
463 
464  /// Integral type presenting hour component.
465  typedef UInt32 Hour;
466 
467  /// Integral type presenting minute component.
468  typedef UInt32 Minute;
469 
470  /// Integral type presenting second component.
471  typedef UInt32 Second;
472 
473  /// Integral type presenting millisecond component.
475 
476  /// Integral type presenting microsecond component.
478 
479  /// Integral type presenting nanosecond component.
481 
482  /// Initializes from number of ticks since epoch.
483  explicit Timestamp(Ticks ticks = 0)
484  : sinceEpoch_(ticks)
485  {
486  }
487 
488  /// Explicit timestamp initialization.
489  ///
490  /// Input parameters are validated, therefore
491  /// constructor throws exception if input values
492  /// do not fit into their valid ranges.
494  Year year,
495  Month month,
496  Day day,
497  Hour hour = 0,
498  Minute minute = 0,
499  Second second = 0,
500  Nanosecond nanosecond = 0)
501  : sinceEpoch_(
502  toTicks(
503  year, month, day,
504  hour, minute, second, nanosecond)
505  )
506  {
507  }
508 
509  /// Initializes as copy of other instance.
511  const Timestamp& other)
512  : sinceEpoch_(other.sinceEpoch_)
513  {
514  }
515 
516  /// Year component of given time point.
517  Year year() const
518  {
519  Year year; Month month; Day day;
520 
521  toDate(sinceEpoch_, year, month, day);
522 
523  return year;
524  }
525 
526  /// Month component of given time point.
527  Month month() const
528  {
529  Year year; Month month; Day day;
530 
531  toDate(sinceEpoch_, year, month, day);
532 
533  return month;
534  }
535 
536  /// Day component of given time point.
537  Day day() const
538  {
539  Year year; Month month; Day day;
540 
541  toDate(sinceEpoch_, year, month, day);
542 
543  return day;
544  }
545 
546  /// Hour component of given time point.
547  Hour hour() const
548  {
549  return static_cast<Hour>(time().hours());
550  }
551 
552  /// Minute component of given time point.
553  Minute minute() const
554  {
555  return static_cast<Minute>(time().minutes());
556  }
557 
558  /// Second component of given time point.
559  Second second() const
560  {
561  return static_cast<Second>(time().seconds());
562  }
563 
564  /// Millisecond component of given time point.
565  Millisecond millisecond() const
566  {
567  return static_cast<Millisecond>(time().milliseconds());
568  }
569 
570  /// Microsecond component of given time point.
571  Microsecond microsecond() const
572  {
573  return static_cast<Microsecond>(time().microseconds());
574  }
575 
576  /// Nanosecond component of given time point.
577  Nanosecond nanosecond() const
578  {
579  return static_cast<Nanosecond>(time().nanoseconds());
580  }
581 
582  /// Timestamp without a time part.
583  Timestamp date() const
584  {
585  return
586  Timestamp(
587  sinceEpoch_ -
588  sinceEpoch_ %
589  TimeTraits::nanosecondsPerDay());
590  }
591 
592  /// Time part of timestamp.
593  TimeSpan time() const
594  {
595  return
596  TimeSpan(
597  sinceEpoch_ %
598  TimeTraits::nanosecondsPerDay());
599  }
600 
601  /// Number of nanoseconds since the Epoch (01-01-1970).
602  Ticks sinceEpoch() const
603  {
604  return sinceEpoch_;
605  }
606 
607  /// Reinitializes as copy of given instance.
608  Timestamp&
609  operator =(
610  const Timestamp& other)
611  {
612  sinceEpoch_ = other.sinceEpoch_;
613 
614  return *this;
615  }
616 
617  /// Exchanges value with other instance.
618  void
620  Timestamp& other)
621  {
622  std::swap(
623  sinceEpoch_,
624  other.sinceEpoch_);
625  }
626 
627 private:
628  // Time interval in nanoseconds since the 01-01-1970.
629  Ticks sinceEpoch_;
630 
631  // Converts structured date-time into ticks.
633  static
634  Ticks
635  toTicks(
636  Year, Month, Day,
637  Hour, Minute, Second,
638  Nanosecond);
639 
640  // Extracts date components from ticks.
642  static
643  void
644  toDate(
645  Ticks,
646  Year&, Month&, Day&);
647 };
648 
649 /// Compares with instances for equality.
650 inline
651 bool
653  const Timestamp& left,
654  const Timestamp& right)
655 {
656  return left.sinceEpoch() == right.sinceEpoch();
657 }
658 
659 /// Compares with instances for inequality.
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 template
671 <
672  UInt64 Value
673 >
674 inline
675 bool
677  const Timestamp& left,
678  const IntegralConstant<UInt64, Value>& right)
679 {
680  return left.sinceEpoch() != right.value();
681 }
682 
683 template
684 <
685  UInt64 Value
686 >
687 inline
688 bool
691  const Timestamp& right)
692 {
693  return left.value() != right.sinceEpoch();
694 }
695 
696 /// Establishes order between two instances.
697 inline
698 bool
700  const Timestamp& left,
701  const Timestamp& right)
702 {
703  return left.sinceEpoch() < 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 /// Adds time interval to given time point.
717 inline
718 Timestamp
720  const Timestamp& timestamp,
721  const TimeSpan& timeSpan)
722 {
723  return
724  Timestamp(
725  timestamp.sinceEpoch() +
726  timeSpan.ticks()
727  );
728 }
729 
730 /// Subtracts time interval from given time point.
731 inline
732 Timestamp
734  const Timestamp& timestamp,
735  const TimeSpan& timeSpan)
736 {
737  return
738  Timestamp(
739  timestamp.sinceEpoch() -
740  timeSpan.ticks()
741  );
742 }
743 
744 /// Calculates time interval between two time points.
745 inline
746 TimeSpan
748  const Timestamp& left,
749  const Timestamp& right)
750 {
751  return
752  TimeSpan(
753  left.sinceEpoch() -
754  right.sinceEpoch()
755  );
756 }
757 
758 // Serialization.
759 
760 /// Serializes timestamp in YYYYMMDD format.
762 void
763 toStrAsYYYYMMDD(std::string&, Timestamp);
764 
765 /// Serializes timestamp in YYYYMMDDHHMMSS format.
767 void
768 toStrAsYYYYMMDDHHMMSS(std::string&, Timestamp);
769 
770 /// Serializes timestamp in YYYYMMDDHHMMSSmsec format.
772 void
773 toStrAsYYYYMMDDHHMMSSmsec(std::string&, Timestamp);
774 
775 /// Serializes timestamp in YYYYMMDDHHMMSSnsec format.
777 void
778 toStrAsYYYYMMDDHHMMSSnsec(std::string&, Timestamp);
779 
780 /// Collection of timestamp formatting patterns.
782 {
783  enum Enum
784  {
785  /// YYYYMMDD.
787 
788  /// YYYYMMDD-HH:MM:SS.
790 
791  /// YYYYMMDD-HH:MM:SS.sss.
793 
794  /// YYYYMMDD-HH:MM:SS.sssssssss.
795  YYYYMMDDHHMMSSnsec
796  };
797 };
798 
799 /// Serializes timestamp according to specified pattern.
800 inline
801 void
803  std::string& str,
804  Timestamp timestamp,
805  TimestampFormat::Enum format =
806  TimestampFormat::YYYYMMDDHHMMSSnsec)
807 {
808  switch (format)
809  {
810  case TimestampFormat::YYYYMMDD:
811  toStrAsYYYYMMDD(str, timestamp);
812  break;
813 
814  case TimestampFormat::YYYYMMDDHHMMSS:
815  toStrAsYYYYMMDDHHMMSS(str, timestamp);
816  break;
817 
818  case TimestampFormat::YYYYMMDDHHMMSSmsec:
819  toStrAsYYYYMMDDHHMMSSmsec(str, timestamp);
820  break;
821 
822  case TimestampFormat::YYYYMMDDHHMMSSnsec:
823  toStrAsYYYYMMDDHHMMSSnsec(str, timestamp);
824  break;
825 
826  default:
827  {
828  throw std::invalid_argument(
829  "Unknown timestamp format pattern specified. ");
830  }
831  }
832 }
833 
834 /// Serializes timestamp according to specified pattern.
835 inline
836 std::string
838  Timestamp timestamp,
839  TimestampFormat::Enum format =
840  TimestampFormat::YYYYMMDDHHMMSSnsec)
841 {
842  std::string str;
843 
844  toStr(str, timestamp, format);
845 
846  return str;
847 }
848 
849 /// Deserializes timestamp from string.
851 bool
852 fromStr(
853  Timestamp&,
854  const Char*,
855  size_t);
856 
857 /// Abstract watch service.
859 {
860  /// Identifies watch service.
861  virtual const Char* id() const = 0;
862 
863  /// Returns current time.
864  virtual Timestamp now() = 0;
865 };
866 
867 /// Local watch.
869 {
870 public:
871  /// Returns current local time.
872  static Timestamp now();
873 
874  /// Returns watch service implementing local watch.
875  static WatchService& service();
876 
877 private:
878  LocalWatch(const LocalWatch&);
879  LocalWatch& operator =(const LocalWatch&);
880 };
881 
882 // UTC watch.
884 {
885 public:
886  /// Returns current UTC time.
887  static Timestamp now();
888 
889  /// Returns watch service implementing UTC watch.
890  static WatchService& service();
891 
892 private:
893  UtcWatch(const UtcWatch&);
894  UtcWatch& operator =(const UtcWatch&);
895 };
896 
897 ONIXS_CMESTREAMLINEDMDH_DATA_PACKING_END
static Int64 nanosecondsPerMinute()
Returns number of nanoseconds in single minute.
Definition: Time.h:48
void toStrAsYYYYMMDDHHMMSSmsec(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSSmsec format.
Collection of timespan formatting patterns.
Definition: Time.h:365
Timestamp(Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
Explicit timestamp initialization.
Definition: Time.h:493
Represents time point without time-zone information.
Definition: Time.h:447
void swap(Timestamp &other)
Exchanges value with other instance.
Definition: Time.h:619
void toStrAsHHMMSSmsec(std::string &, TimeSpan)
Minute minute() const
Minute component of given time point.
Definition: Time.h:553
UInt64 UInt64
uInt64.
Definition: Fields.h:187
Hour hour() const
Hour component of given time point.
Definition: Time.h:547
Nanoseconds nanoseconds() const
Nanoseconds component of time interval.
Definition: Time.h:258
void toStrAsYYYYMMDDHHMMSSnsec(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSSnsec format.
static Int64 nanosecondsPerDay()
Returns number of nanoseconds in single day.
Definition: Time.h:36
Year year() const
Year component of given time point.
Definition: Time.h:517
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:465
Nanosecond nanosecond() const
Nanosecond component of given time point.
Definition: Time.h:577
Millisecond millisecond() const
Millisecond component of given time point.
Definition: Time.h:565
Int32 Microseconds
Integral type for number of microseconds.
Definition: Time.h:126
Int32 Seconds
Integral type for number of seconds.
Definition: Time.h:120
bool fromStr(Timestamp &, const Char *, size_t)
Deserializes timestamp from string.
Identifies months in year.
Definition: Time.h:427
bool operator==(const Timestamp &left, const Timestamp &right)
Compares with instances for equality.
Definition: Time.h:652
void toStrAsYYYYMMDD(std::string &, Timestamp)
Serializes timestamp in YYYYMMDD format.
Month month() const
Month component of given time point.
Definition: Time.h:527
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
Initializes with given set of values.
Definition: Time.h:144
UInt32 Millisecond
Integral type presenting millisecond component.
Definition: Time.h:474
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
Microseconds component of time interval.
Definition: Time.h:246
UInt32 Year
Integral type presenting year component.
Definition: Time.h:454
void toStrAsHHMMSS(std::string &, TimeSpan)
void toStrAsSDHHMMSSnsec(std::string &, TimeSpan)
static Int32 secondsPerMinute()
Returns number of seconds in single minute.
Definition: Time.h:84
UInt32 Day
Integral type presenting day component.
Definition: Time.h:462
UInt64 Ticks
Integral type storing internal ticks.
Definition: Time.h:451
UInt32 Nanosecond
Integral type presenting nanosecond component.
Definition: Time.h:480
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition: Bootstrap.h:173
#define ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS
Definition: Bootstrap.h:111
bool operator<(const Timestamp &left, const Timestamp &right)
Establishes order between two instances.
Definition: Time.h:699
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED
Definition: Compiler.h:160
char Char
Character type alias.
Definition: String.h:36
Day day() const
Day component of given time point.
Definition: Time.h:537
Milliseconds milliseconds() const
Milliseconds component of time interval.
Definition: Time.h:234
UInt32 Microsecond
Integral type presenting microsecond component.
Definition: Time.h:477
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_CLASS
Definition: Bootstrap.h:63
Microsecond microsecond() const
Microsecond component of given time point.
Definition: Time.h:571
Abstract watch service.
Definition: Time.h:858
TimeSpan time() const
Time part of timestamp.
Definition: Time.h:593
Int32 seconds() const
Seconds component of time interval.
Definition: Time.h:222
Hours hours() const
Hours component of time interval.
Definition: Time.h:198
Days days() const
Days component of time interval.
Definition: Time.h:188
Int32 minutes() const
Minutes component of time interval.
Definition: Time.h:210
static Int32 microsecondsPerSecond()
Returns number of microseconds in single second.
Definition: Time.h:96
#define ONIXS_CMESTREAMLINEDMDH_LTWT_EXPORTED
Definition: Bootstrap.h:119
Second second() const
Second component of given time point.
Definition: Time.h:559
Int32 Nanoseconds
Integral type for number of nanoseconds.
Definition: Time.h:129
Collection of timestamp formatting patterns.
Definition: Time.h:781
void toStrAsYYYYMMDDHHMMSS(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSS format.
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:67
UInt32 Second
Integral type presenting second component.
Definition: Time.h:471
void swap(TimeSpan &other)
Exchanges with given instance.
Definition: Time.h:298
UInt32 Minute
Integral type presenting minute component.
Definition: Time.h:468
Timestamp(Ticks ticks=0)
Initializes from number of ticks since epoch.
Definition: Time.h:483
bool operator!=(const IntegralConstant< UInt64, Value > &left, const Timestamp &right)
Definition: Time.h:689
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:510
Represents time interval.
Definition: Time.h:104
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)
Initializes with given set of values.
Definition: Time.h:170
Ticks ticks() const
Number of ticks in given time interval.
Definition: Time.h:271
#define ONIXS_CMESTREAMLINEDMDH_LTWT_STRUCT
Definition: Bootstrap.h:115
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:837
TimeSpan operator-(const Timestamp &left, const Timestamp &right)
Calculates time interval between two time points.
Definition: Time.h:747
OnixS::CME::Streamlined::MDH::Month::Enum Month
Type presenting month component.
Definition: Time.h:459
Int32 Milliseconds
Integral type for number of milliseconds.
Definition: Time.h:123
Timestamp date() const
Timestamp without a time part.
Definition: Time.h:583
Timestamp operator+(const Timestamp &timestamp, const TimeSpan &timeSpan)
Adds time interval to given time point.
Definition: Time.h:719
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:602
TimeSpan(Ticks ticks=0)
Initializes timespan from given number of ticks.
Definition: Time.h:132
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:169
bool operator>(const Timestamp &left, const Timestamp &right)
Establishes order between two instances.
Definition: Time.h:709