OnixS C++ CME MDP Premium Market Data Handler  5.8.9
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 
26 #include <OnixS/CME/MDH/String.h>
27 #include <OnixS/CME/MDH/Integral.h>
28 
30 ONIXS_CMEMDH_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.
144  TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
145  : ticks_(
146  static_cast<Ticks>(days) * TimeTraits::nanosecondsPerDay()
147  + static_cast<Ticks>(hours) * TimeTraits::nanosecondsPerHour()
148  + static_cast<Ticks>(minutes) * TimeTraits::nanosecondsPerMinute()
149  + static_cast<Ticks>(seconds) * TimeTraits::nanosecondsPerSecond() + nanoseconds
150  )
151  {
152  }
153 
154  /// Initializes with given set of values.
155  ///
156  /// Input parameters are treated as quantities,
157  /// but not as a time stamp. Therefore, there's
158  /// no requirement to fit in a certain range like
159  /// hours must fit into [0, 24) range. After
160  /// initialization time span will be normalized.
161  TimeSpan(Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
162  : ticks_(
163  static_cast<Ticks>(hours) * TimeTraits::nanosecondsPerHour()
164  + static_cast<Ticks>(minutes) * TimeTraits::nanosecondsPerMinute()
165  + static_cast<Ticks>(seconds) * TimeTraits::nanosecondsPerSecond() + nanoseconds
166  )
167  {
168  }
169 
170  /// Initializes instance as a copy of the other one.
171  TimeSpan(const TimeSpan& other)
172  : ticks_(other.ticks_)
173  {
174  }
175 
176  /// Days component of time interval.
177  /// Whole number of days in time interval.
178  Days days() const
179  {
180  return static_cast<Days>(ticks_ / TimeTraits::nanosecondsPerDay());
181  }
182 
183  /// Hours component of time interval.
184  /// Values are in range from -23 through 23.
185  Hours hours() const
186  {
187  return static_cast<Hours>((ticks_ / TimeTraits::nanosecondsPerHour()) % TimeTraits::hoursPerDay());
188  }
189 
190  /// Minutes component of time interval.
191  /// Values are in range from -59 through 59.
192  Int32 minutes() const
193  {
194  return static_cast<Minutes>((ticks_ / TimeTraits::nanosecondsPerMinute()) % TimeTraits::minutesPerHour());
195  }
196 
197  /// Seconds component of time interval.
198  /// Values are in range from -59 through 59.
199  Int32 seconds() const
200  {
201  return static_cast<Seconds>((ticks_ / TimeTraits::nanosecondsPerSecond()) % TimeTraits::secondsPerMinute());
202  }
203 
204  /// Milliseconds component of time interval.
205  /// Values are in range from -999 through 999.
206  Milliseconds milliseconds() const
207  {
208  return static_cast<Milliseconds>(
209  (ticks_ / TimeTraits::nanosecondsPerMillisecond()) % TimeTraits::millisecondsPerSecond()
210  );
211  }
212 
213  /// Microseconds component of time interval.
214  /// Values are in range from -999999 through 999999.
215  Microseconds microseconds() const
216  {
217  return static_cast<Microseconds>(
218  (ticks_ / TimeTraits::nanosecondsPerMicrosecond()) % TimeTraits::microsecondsPerSecond()
219  );
220  }
221 
222  /// Nanoseconds component of time interval.
223  /// Values are in range from -999999999 through 999999999.
224  Nanoseconds nanoseconds() const
225  {
226  return static_cast<Nanoseconds>(ticks_ % TimeTraits::nanosecondsPerSecond());
227  }
228 
229  /// Number of ticks in given time interval.
230  ///
231  /// Ticks are the lowest time quantity used
232  /// to measure time intervals. In current
233  /// implementation ticks are nanoseconds.
234  Ticks ticks() const
235  {
236  return ticks_;
237  }
238 
239  /// Adds time interval to current one.
240  TimeSpan& operator+=(const TimeSpan& other)
241  {
242  ticks_ += other.ticks_;
243 
244  return *this;
245  }
246 
247  /// Subtracts time interval from current one.
248  TimeSpan& operator-=(const TimeSpan& other)
249  {
250  ticks_ -= other.ticks_;
251 
252  return *this;
253  }
254 
255  /// Reinitializes as copy of given instance.
256  TimeSpan& operator=(const TimeSpan& other)
257  {
258  ticks_ = other.ticks_;
259 
260  return *this;
261  }
262 
263  /// Exchanges with given instance.
264  void swap(TimeSpan& other)
265  {
266  std::swap(ticks_, other.ticks_);
267  }
268 
269 private:
270  Ticks ticks_;
271 };
272 
273 /// Compares with other instance for equality.
274 inline bool operator==(const TimeSpan& left, const TimeSpan& right)
275 {
276  return left.ticks() == right.ticks();
277 }
278 
279 /// Compares with other instance for in-equality.
280 inline bool operator!=(const TimeSpan& left, const TimeSpan& right)
281 {
282  return left.ticks() != right.ticks();
283 }
284 
285 /// Checks whether left time interval less than right one.
286 inline bool operator<(const TimeSpan& left, const TimeSpan& right)
287 {
288  return left.ticks() < right.ticks();
289 }
290 
291 /// Checks whether left time interval greater than right one.
292 inline bool operator>(const TimeSpan& left, const TimeSpan& right)
293 {
294  return left.ticks() > right.ticks();
295 }
296 
297 // TimeSpan serialization.
298 
299 // Serializes timespan according to HH:MM:SS pattern.
301 void toStrAsHHMMSS(std::string&, TimeSpan);
302 
303 // Serializes timespan according to HH:MM:SS.sss pattern.
305 void toStrAsHHMMSSmsec(std::string&, TimeSpan);
306 
307 // Serializes timespan according to D.HH:MM:SS.sssssssss pattern.
309 void toStrAsSDHHMMSSnsec(std::string&, TimeSpan);
310 
311 /// Collection of timespan formatting patterns.
313 {
314  enum Enum
315  {
316  /// HH:MM:SS.
318 
319  /// HH:MM:SS.sss.
321 
322  /// D.HH:MM:SS.sssssssss.
323  SDHHMMSSnsec
324  };
325 };
326 
327 /// Appends timespan formatted in specified pattern to given string.
328 inline void toStr(std::string& str, TimeSpan timeSpan, TimeSpanFormat::Enum format = TimeSpanFormat::SDHHMMSSnsec)
329 {
330  switch (format)
331  {
332  case TimeSpanFormat::HHMMSS:
333  toStrAsHHMMSS(str, timeSpan);
334  break;
335 
336  case TimeSpanFormat::HHMMSSmsec:
337  toStrAsHHMMSSmsec(str, timeSpan);
338  break;
339 
340  case TimeSpanFormat::SDHHMMSSnsec:
341  toStrAsSDHHMMSSnsec(str, timeSpan);
342  break;
343 
344  default:
345  {
346  throw std::invalid_argument("Unknown timespan format pattern specified. ");
347  }
348  }
349 }
350 
351 /// Formats timespan according to specified pattern.
352 inline std::string toStr(TimeSpan timeSpan, TimeSpanFormat::Enum format = TimeSpanFormat::SDHHMMSSnsec)
353 {
354  std::string str;
355 
356  toStr(str, timeSpan, format);
357 
358  return str;
359 }
360 
361 /// Identifies months in year.
363 {
364  /// Defines numeric value sufficient
365  /// to hold enumeration values.
366  typedef UInt32 Base;
367 
368  /// Identifies months in year.
369  enum Enum
370  {
371  January = 1,
382  December
383  };
384 };
385 
386 /// Represents time point without time-zone information.
388 {
389 public:
390  /// Integral type storing internal ticks.
391  typedef UInt64 Ticks;
392 
393  /// Integral type presenting year component.
394  typedef UInt32 Year;
395 
396  /// Type presenting month component.
398 
399  /// Integral type presenting day component.
400  typedef UInt32 Day;
401 
402  /// Integral type presenting hour component.
403  typedef UInt32 Hour;
404 
405  /// Integral type presenting minute component.
406  typedef UInt32 Minute;
407 
408  /// Integral type presenting second component.
409  typedef UInt32 Second;
410 
411  /// Integral type presenting millisecond component.
413 
414  /// Integral type presenting microsecond component.
416 
417  /// Integral type presenting nanosecond component.
419 
420  /// Initializes from number of ticks since epoch.
421  explicit Timestamp(Ticks ticks = 0)
422  : sinceEpoch_(ticks)
423  {
424  }
425 
426  /// Explicit time-stamp initialization.
427  ///
428  /// Input parameters are validated, therefore
429  /// constructor throws exception if input values
430  /// do not fit into their valid ranges.
432  Year year,
433  Month month,
434  Day day,
435  Hour hour = 0,
436  Minute minute = 0,
437  Second second = 0,
438  Nanosecond nanosecond = 0
439  )
440  : sinceEpoch_(toTicks(year, month, day, hour, minute, second, nanosecond))
441  {
442  }
443 
444  /// Year component of given time point.
445  Year year() const
446  {
447  Year year;
448  Month month;
449  Day day;
450 
451  toDate(sinceEpoch_, year, month, day);
452 
453  return year;
454  }
455 
456  /// Month component of given time point.
457  Month month() const
458  {
459  Year year;
460  Month month;
461  Day day;
462 
463  toDate(sinceEpoch_, year, month, day);
464 
465  return month;
466  }
467 
468  /// Day component of given time point.
469  Day day() const
470  {
471  Year year;
472  Month month;
473  Day day;
474 
475  toDate(sinceEpoch_, year, month, day);
476 
477  return day;
478  }
479 
480  /// Hour component of given time point.
481  Hour hour() const
482  {
483  return static_cast<Hour>(time().hours());
484  }
485 
486  /// Minute component of given time point.
487  Minute minute() const
488  {
489  return static_cast<Minute>(time().minutes());
490  }
491 
492  /// Second component of given time point.
493  Second second() const
494  {
495  return static_cast<Second>(time().seconds());
496  }
497 
498  /// Millisecond component of given time point.
499  Millisecond millisecond() const
500  {
501  return static_cast<Millisecond>(time().milliseconds());
502  }
503 
504  /// Microsecond component of given time point.
505  Microsecond microsecond() const
506  {
507  return static_cast<Microsecond>(time().microseconds());
508  }
509 
510  /// Nanosecond component of given time point.
511  Nanosecond nanosecond() const
512  {
513  return static_cast<Nanosecond>(time().nanoseconds());
514  }
515 
516  /// Timestamp without a time part.
517  Timestamp date() const
518  {
519  return Timestamp(sinceEpoch_ - sinceEpoch_ % TimeTraits::nanosecondsPerDay());
520  }
521 
522  /// Time part of timestamp.
523  TimeSpan time() const
524  {
525  return TimeSpan(sinceEpoch_ % TimeTraits::nanosecondsPerDay());
526  }
527 
528  /// Number of nanoseconds since the Epoch (01-01-1970).
529  Ticks sinceEpoch() const
530  {
531  return sinceEpoch_;
532  }
533 
534  /// Exchanges value with other instance.
535  void swap(Timestamp& other)
536  {
537  std::swap(sinceEpoch_, other.sinceEpoch_);
538  }
539 
540 private:
541  // Time interval in nanoseconds since the 01-01-1970.
542  Ticks sinceEpoch_;
543 
544  // Converts structured date-time into ticks.
546  static Ticks toTicks(Year, Month, Day, Hour, Minute, Second, Nanosecond);
547 
548  // Extracts date components from ticks.
550  static void toDate(Ticks, Year&, Month&, Day&);
551 };
552 
553 /// Compares with instances for equality.
554 inline bool operator==(const Timestamp& left, const Timestamp& right)
555 {
556  return (left.sinceEpoch() == right.sinceEpoch());
557 }
558 
559 /// Compares with instances for inequality.
560 inline bool operator!=(const Timestamp& left, const Timestamp& right)
561 {
562  return (left.sinceEpoch() != right.sinceEpoch());
563 }
564 
565 /// Establishes order between two instances.
566 inline bool operator<(const Timestamp& left, const Timestamp& right)
567 {
568  return (left.sinceEpoch() < right.sinceEpoch());
569 }
570 
571 /// Establishes order between two instances.
572 inline bool operator<=(const Timestamp& left, const Timestamp& right)
573 {
574  return (left.sinceEpoch() <= right.sinceEpoch());
575 }
576 
577 /// Establishes order between two instances.
578 inline bool operator>(const Timestamp& left, const Timestamp& right)
579 {
580  return (left.sinceEpoch() > right.sinceEpoch());
581 }
582 
583 /// Establishes order between two instances.
584 inline bool operator>=(const Timestamp& left, const Timestamp& right)
585 {
586  return (left.sinceEpoch() >= right.sinceEpoch());
587 }
588 
589 /// Adds time interval to given time point.
590 inline Timestamp operator+(const Timestamp& timestamp, const TimeSpan& timeSpan)
591 {
592  return Timestamp(timestamp.sinceEpoch() + timeSpan.ticks());
593 }
594 
595 /// Subtracts time interval from given time point.
596 inline Timestamp operator-(const Timestamp& timestamp, const TimeSpan& timeSpan)
597 {
598  return Timestamp(timestamp.sinceEpoch() - timeSpan.ticks());
599 }
600 
601 /// Calculates time interval between two time points.
602 inline TimeSpan operator-(const Timestamp& left, const Timestamp& right)
603 {
604  return TimeSpan(left.sinceEpoch() - right.sinceEpoch());
605 }
606 
607 // Serialization.
608 
609 /// Serializes timestamp in YYYYMMDD format.
611 void toStrAsYYYYMMDD(std::string&, Timestamp);
612 
613 /// Serializes timestamp in YYYYMMDDHHMMSS format.
615 void toStrAsYYYYMMDDHHMMSS(std::string&, Timestamp);
616 
617 /// Serializes timestamp in YYYYMMDDHHMMSSmsec format.
619 void toStrAsYYYYMMDDHHMMSSmsec(std::string&, Timestamp);
620 
621 /// Serializes timestamp in YYYYMMDDHHMMSSnsec format.
623 void toStrAsYYYYMMDDHHMMSSnsec(std::string&, Timestamp);
624 
625 /// Collection of timestamp formatting patterns.
627 {
628  enum Enum
629  {
630  /// YYYYMMDD.
632 
633  /// YYYYMMDD-HH:MM:SS.
635 
636  /// YYYYMMDD-HH:MM:SS.sss.
638 
639  /// YYYYMMDD-HH:MM:SS.sssssssss.
640  YYYYMMDDHHMMSSnsec
641  };
642 };
643 
644 /// Serializes timestamp according to specified pattern.
645 inline void
646 toStr(std::string& str, Timestamp timestamp, TimestampFormat::Enum format = TimestampFormat::YYYYMMDDHHMMSSnsec)
647 {
648  switch (format)
649  {
650  case TimestampFormat::YYYYMMDD:
651  toStrAsYYYYMMDD(str, timestamp);
652  break;
653 
654  case TimestampFormat::YYYYMMDDHHMMSS:
655  toStrAsYYYYMMDDHHMMSS(str, timestamp);
656  break;
657 
658  case TimestampFormat::YYYYMMDDHHMMSSmsec:
659  toStrAsYYYYMMDDHHMMSSmsec(str, timestamp);
660  break;
661 
662  case TimestampFormat::YYYYMMDDHHMMSSnsec:
663  toStrAsYYYYMMDDHHMMSSnsec(str, timestamp);
664  break;
665 
666  default:
667  {
668  throw std::invalid_argument("Unknown timestamp format pattern specified. ");
669  }
670  }
671 }
672 
673 /// Serializes timestamp according to specified pattern.
674 inline std::string toStr(Timestamp timestamp, TimestampFormat::Enum format = TimestampFormat::YYYYMMDDHHMMSSnsec)
675 {
676  std::string str;
677 
678  toStr(str, timestamp, format);
679 
680  return str;
681 }
682 
683 /// De-serializes a timestamp from the given string.
685 bool fromStr(Timestamp&, const Char*, size_t);
686 
687 inline bool fromStr(Timestamp& ts, const std::string& str)
688 {
689  return fromStr(ts, str.c_str(), str.size());
690 }
691 
692 ONIXS_CMEMDH_DATA_PACKING_END
Ticks ticks() const
Number of ticks in given time interval.
Definition: Time.h:234
Microsecond microsecond() const
Microsecond component of given time point.
Definition: Time.h:505
static Int64 nanosecondsPerDay()
Returns number of nanoseconds in single day.
Definition: Time.h:36
Int32 Int32
int32.
Definition: Fields.h:60
TimeSpan & operator=(const TimeSpan &other)
Reinitializes as copy of given instance.
Definition: Time.h:256
static Int32 millisecondsPerSecond()
Returns number of milliseconds in single second.
Definition: Time.h:90
void toStrAsHHMMSSmsec(std::string &, TimeSpan)
Timestamp(Ticks ticks=0)
Initializes from number of ticks since epoch.
Definition: Time.h:421
Milliseconds milliseconds() const
Milliseconds component of time interval.
Definition: Time.h:206
Microseconds microseconds() const
Microseconds component of time interval.
Definition: Time.h:215
void toStrAsYYYYMMDDHHMMSSnsec(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSSnsec format.
bool fromStr(Timestamp &ts, const std::string &str)
Definition: Time.h:687
static Int32 nanosecondsPerMicrosecond()
Returns number of nanoseconds in single microsecond.
Definition: Time.h:66
UInt32 Day
Integral type presenting day component.
Definition: Time.h:400
Int32 Hours
Integral type for number of hours.
Definition: Time.h:114
static Int64 nanosecondsPerMinute()
Returns number of nanoseconds in single minute.
Definition: Time.h:48
bool operator>=(const Timestamp &left, const Timestamp &right)
Establishes order between two instances.
Definition: Time.h:584
UInt32 UInt32
uInt32.
Definition: Fields.h:192
Days days() const
Days component of time interval.
Definition: Time.h:178
Collection of timestamp formatting patterns.
Definition: Time.h:626
Represents time point without time-zone information.
Definition: Time.h:387
Hours hours() const
Hours component of time interval.
Definition: Time.h:185
Identifies months in year.
Definition: Time.h:362
static Int32 microsecondsPerSecond()
Returns number of microseconds in single second.
Definition: Time.h:96
Int64 Ticks
Integral type presenting internal ticks.
Definition: Time.h:108
Timestamp date() const
Timestamp without a time part.
Definition: Time.h:517
Timestamp timestamp(const MultiContainer &, Tag)
Retrieves last update time field value.
TimeSpan & operator-=(const TimeSpan &other)
Subtracts time interval from current one.
Definition: Time.h:248
static Int32 minutesPerHour()
Returns number of minutes in single hour.
Definition: Time.h:78
Year year() const
Year component of given time point.
Definition: Time.h:445
Collection of timespan formatting patterns.
Definition: Time.h:312
UInt32 Nanosecond
Integral type presenting nanosecond component.
Definition: Time.h:418
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
TimeSpan(const TimeSpan &other)
Initializes instance as a copy of the other one.
Definition: Time.h:171
Int32 Nanoseconds
Integral type for number of nanoseconds.
Definition: Time.h:129
Millisecond millisecond() const
Millisecond component of given time point.
Definition: Time.h:499
Ticks sinceEpoch() const
Number of nanoseconds since the Epoch (01-01-1970).
Definition: Time.h:529
Second second() const
Second component of given time point.
Definition: Time.h:493
char Char
Character type alias.
Definition: String.h:36
void toStrAsHHMMSS(std::string &, TimeSpan)
UInt32 Hour
Integral type presenting hour component.
Definition: Time.h:403
UInt64 UInt64
uInt64.
Definition: Fields.h:195
Int32 Milliseconds
Integral type for number of milliseconds.
Definition: Time.h:123
bool operator<(const Timestamp &left, const Timestamp &right)
Establishes order between two instances.
Definition: Time.h:566
void toStrAsSDHHMMSSnsec(std::string &, TimeSpan)
Hour hour() const
Hour component of given time point.
Definition: Time.h:481
Int32 minutes() const
Minutes component of time interval.
Definition: Time.h:192
TimeSpan(Ticks ticks=0)
Initializes timespan from given number of ticks.
Definition: Time.h:132
Nanoseconds nanoseconds() const
Nanoseconds component of time interval.
Definition: Time.h:224
Represents time interval.
Definition: Time.h:104
Int32 seconds() const
Seconds component of time interval.
Definition: Time.h:199
static Int32 hoursPerDay()
Returns number of hours in single day.
Definition: Time.h:72
bool operator<=(const Timestamp &left, const Timestamp &right)
Establishes order between two instances.
Definition: Time.h:572
UInt32 Second
Integral type presenting second component.
Definition: Time.h:409
void toStrAsYYYYMMDD(std::string &, Timestamp)
Serializes timestamp in YYYYMMDD format.
Timestamp operator+(const Timestamp &timestamp, const TimeSpan &timeSpan)
Adds time interval to given time point.
Definition: Time.h:590
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
UInt32 Minute
Integral type presenting minute component.
Definition: Time.h:406
Int32 Seconds
Integral type for number of seconds.
Definition: Time.h:120
void swap(TimeSpan &other)
Exchanges with given instance.
Definition: Time.h:264
UInt32 Microsecond
Integral type presenting microsecond component.
Definition: Time.h:415
Int32 Microseconds
Integral type for number of microseconds.
Definition: Time.h:126
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:160
UInt32 Base
Defines numeric value sufficient to hold enumeration values.
Definition: Time.h:366
bool operator>(const Timestamp &left, const Timestamp &right)
Establishes order between two instances.
Definition: Time.h:578
TimeSpan time() const
Time part of timestamp.
Definition: Time.h:523
UInt64 Ticks
Integral type storing internal ticks.
Definition: Time.h:391
TimeSpan operator-(const Timestamp &left, const Timestamp &right)
Calculates time interval between two time points.
Definition: Time.h:602
#define ONIXS_CMEMDH_LTWT_EXPORTED
Definition: Bootstrap.h:47
UInt32 Year
Integral type presenting year component.
Definition: Time.h:394
void toStrAsYYYYMMDDHHMMSS(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSS format.
Miscellaneous time characteristics.
Definition: Time.h:33
TimeSpan(Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
Initializes with given set of values.
Definition: Time.h:161
void swap(Timestamp &other)
Exchanges value with other instance.
Definition: Time.h:535
Nanosecond nanosecond() const
Nanosecond component of given time point.
Definition: Time.h:511
Timestamp(Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
Explicit time-stamp initialization.
Definition: Time.h:431
static Int32 nanosecondsPerMillisecond()
Returns number of nanoseconds in single millisecond.
Definition: Time.h:60
std::string toStr(Timestamp timestamp, TimestampFormat::Enum format=TimestampFormat::YYYYMMDDHHMMSSnsec)
Serializes timestamp according to specified pattern.
Definition: Time.h:674
void toStrAsYYYYMMDDHHMMSSmsec(std::string &, Timestamp)
Serializes timestamp in YYYYMMDDHHMMSSmsec format.
static Int32 secondsPerMinute()
Returns number of seconds in single minute.
Definition: Time.h:84
static Int64 nanosecondsPerHour()
Returns number of nanoseconds in single hour.
Definition: Time.h:42
bool operator!=(const Timestamp &left, const Timestamp &right)
Compares with instances for inequality.
Definition: Time.h:560
Month month() const
Month component of given time point.
Definition: Time.h:457
bool operator==(const Timestamp &left, const Timestamp &right)
Compares with instances for equality.
Definition: Time.h:554
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
Initializes with given set of values.
Definition: Time.h:144
Day day() const
Day component of given time point.
Definition: Time.h:469
TimeSpan & operator+=(const TimeSpan &other)
Adds time interval to current one.
Definition: Time.h:240
Minute minute() const
Minute component of given time point.
Definition: Time.h:487
Int32 Minutes
Integral type for number of minutes.
Definition: Time.h:117
Enum
Identifies months in year.
Definition: Time.h:369
OnixS::CME::MDH::Month::Enum Month
Type presenting month component.
Definition: Time.h:397
Int32 Days
Integral type for number of days.
Definition: Time.h:111
UInt32 Millisecond
Integral type presenting millisecond component.
Definition: Time.h:412
static Int32 nanosecondsPerSecond()
Returns number of nanoseconds in single second.
Definition: Time.h:54
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68