OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
TimeSpan.h
Go to the documentation of this file.
1/*
2* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3*
4* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5* and international copyright treaties.
6*
7* Access to and use of the software is governed by the terms of the applicable OnixS Software
8* Services Agreement (the Agreement) and Customer end user license agreements granting
9* a non-assignable, non-transferable and non-exclusive license to use the software
10* for it's own data processing purposes under the terms defined in the Agreement.
11*
12* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13* of this source code or associated reference material to any other location for further reproduction
14* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15*
16* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17* the terms of the Agreement is a violation of copyright law.
18*/
19
20#pragma once
21
22#include <string>
23
24#include <OnixS/FIXEngine/ABI.h>
26
27#define ONIXS_MINMAX_ABUSER
28
29namespace OnixS {
30namespace FIX {
31typedef UInt32 Amount;
33
36
37typedef Interval Days;
41
46
52
71
91
94{
95public:
98
103
108
111 Hours hours,
114
117 Days days,
118 Hours hours,
122
125 Days days,
126 Hours hours,
129 Picoseconds picooseconds);
130
133
135 Days days() const;
136
138 Hours hours() const;
139
142
145
148
151
154
156 Picoseconds picoseconds() const;
157
160
162 bool operator == (const TimeSpan &) const;
163
165 bool operator != (const TimeSpan &) const;
166
168 bool operator < (const TimeSpan &) const;
169
171 TimeSpan & operator += (const TimeSpan &);
172
174 TimeSpan & operator -= (const TimeSpan &);
175
178
181
183 static TimeSpan zero();
184
189
191 static
193 parse(const std::string &);
194
195protected:
196 friend class TimeManager;
197
200
201 void normalize();
202};
203
204inline
207{
208 return seconds_;
209}
210
211inline
214{
215 return picoseconds_;
216}
217
219{
220public:
222};
223
226{
227public:
229};
230
237
244
252
260
268
276}
277}
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
#define ONIXS_MINMAX_ABUSER
Definition TimeSpan.h:27
HourSpan(Hours hours)
MicrosecondSpan(TotalMicroseconds microseconds)
MillisecondSpan(TotalMilliseconds milliseconds)
MinuteSpan(Minutes minutes)
NanosecondSpan(TotalNanoseconds nanoseconds)
PicosecondSpan(TotalPicoseconds picoseconds)
SecondSpan(TotalSeconds seconds)
void toString(std::string &, TimeSpanFormat::Enum=TimeSpanFormat::HHMMSSNsec) const
Milliseconds milliseconds() const
Current milliseconds.
static TimeSpan zero()
The zero value of the time span.
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds)
Initializes the TimeSpan from days, hours, minutes, seconds and nanoseconds.
TimeSpan()
Constructs an uninitialized instance.
friend class TimeManager
Definition TimeSpan.h:196
TimeSpan(Hours hours, Minutes minutes, Seconds seconds)
Initializes the TimeSpan from hours, minutes and seconds.
std::string toString(TimeSpanFormat::Enum=TimeSpanFormat::HHMMSSNsec) const
Returns the time span text presentation in the requested format ("HH:MM:SS.sssssssss" by default).
Nanoseconds nanoseconds() const
Current nanoseconds.
TimeSpan(TotalSeconds seconds, Nanoseconds nanoseconds)
Initializes the TimeSpan from seconds and nanoseconds.
Microseconds microseconds() const
Current microseconds.
static TimeSpan parse(const std::string &)
Parses time span from its text presentation.
Days days() const
Current days.
TotalSeconds seconds_
Definition TimeSpan.h:198
static TimeSpan min()
The minimum value of the time span.
TotalSeconds totalSeconds() const
The total number of seconds.
Definition TimeSpan.h:206
Picoseconds picoseconds_
Definition TimeSpan.h:199
Picoseconds picoseconds() const
Current nanoseconds.
Definition TimeSpan.h:213
static TimeSpan max()
The maximum value of the time span.
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Picoseconds picooseconds)
Initializes the TimeSpan from days, hours, minutes, seconds and picoseconds.
TimeSpan(TotalSeconds seconds, Picoseconds picoseconds)
Initializes the TimeSpan from seconds and picoseconds.
Hours hours() const
Current hours.
Seconds seconds() const
Current seconds.
Minutes minutes() const
Current minutes.
TimeSpan absolute() const
The current absolute time span.
HugeInterval TotalPicoseconds
Definition TimeSpan.h:51
UInt64 HugeAmount
Definition TimeSpan.h:32
HugeInterval TotalNanoseconds
Definition TimeSpan.h:50
HugeInterval TotalMicroseconds
Definition TimeSpan.h:49
Interval Milliseconds
Definition TimeSpan.h:42
Interval Nanoseconds
Definition TimeSpan.h:44
Int64 HugeInterval
Definition TimeSpan.h:35
UInt32 Amount
Definition TimeSpan.h:31
HugeInterval TotalMilliseconds
Definition TimeSpan.h:48
unsigned int UInt32
Definition Numeric.h:36
long long Int64
Definition Numeric.h:38
HugeInterval Picoseconds
Definition TimeSpan.h:45
Interval Minutes
Definition TimeSpan.h:39
Interval Hours
Definition TimeSpan.h:38
Interval Seconds
Definition TimeSpan.h:40
unsigned long long UInt64
Definition Numeric.h:39
Int32 Interval
Definition TimeSpan.h:34
Interval Microseconds
Definition TimeSpan.h:43
Interval Days
Definition TimeSpan.h:37
int Int32
Definition Numeric.h:35
HugeInterval TotalSeconds
Definition TimeSpan.h:47
Time related constants.
Definition TimeSpan.h:54
static const Minutes MinutesPerHour
Definition TimeSpan.h:56
static const Picoseconds PicosecondsPerMicrosecond
Definition TimeSpan.h:67
static const Milliseconds MillisecondsPerSecond
Definition TimeSpan.h:62
static const Picoseconds PicosecondsPerNanosecond
Definition TimeSpan.h:66
static const Picoseconds PicosecondsPerMillisecond
Definition TimeSpan.h:68
static const Nanoseconds NanosecondsPerSecond
Definition TimeSpan.h:64
static const Picoseconds PicosecondsPerSecond
Definition TimeSpan.h:69
static const Seconds SecondsPerHour
Definition TimeSpan.h:59
static const Seconds SecondsPerMinute
Definition TimeSpan.h:58
static const Microseconds MicrosecondsPerSecond
Definition TimeSpan.h:63
static const Hours HoursPerDay
Definition TimeSpan.h:55
static const Seconds SecondsPerDay
Definition TimeSpan.h:60
The collection of time span formats supported.
Definition TimeSpan.h:73
@ HHMMSSNsec
Indicates the time span in the "HH:MM:SS.sssssssss" format.
Definition TimeSpan.h:85
@ HHMMSSUsec
Indicates the time span in the "HH:MM:SS.ssssss" format.
Definition TimeSpan.h:82
@ HHMMSSPsec
Indicates the time span in the "HH:MM:SS.ssssssssssss" format.
Definition TimeSpan.h:88
@ HHMMSSMsec
Indicates the time span in the "HH:MM:SS.sss" format.
Definition TimeSpan.h:79
@ HHMMSS
Indicates the time span in the "HH:MM:SS" format.
Definition TimeSpan.h:76