CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
timespan.h
1
3#pragma once
4
5#include <system/string.h>
6#include <system/boxable_traits.h>
7#include <system/iformatprovider.h>
8#include <system/globalization/time_span_styles.h>
9#include <functional>
10
11namespace System {
12
13namespace Globalization {
14 class CultureInfo;
15 class DateTimeFormatInfo;
16}
17
58class ASPOSECPP_SHARED_CLASS TimeSpan final
59{
60public:
62 static ASPOSECPP_SHARED_API const TimeSpan Zero;
64 static ASPOSECPP_SHARED_API const TimeSpan MaxValue;
66 static ASPOSECPP_SHARED_API const TimeSpan MinValue;
67
69 static constexpr int64_t TicksPerDay = 864000000000ULL;
71 static constexpr int64_t TicksPerHour = 36000000000ULL;
73 static constexpr int64_t TicksPerMillisecond = 10000ULL;
75 static constexpr int64_t TicksPerMinute = 600000000ULL;
77 static constexpr int64_t TicksPerSecond = 10000000ULL;
78
80 constexpr TimeSpan() : m_ticks(0) {}
81
82 // dotnetTicks - .NET ticks as 100ns since 0001.01.01-00:00:00
85 explicit constexpr TimeSpan(int64_t ticks) : m_ticks(ticks) {}
86
91 ASPOSECPP_SHARED_API TimeSpan(int hours, int minutes, int seconds);
92
99 ASPOSECPP_SHARED_API TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds = 0);
100
102 constexpr TimeSpan(const TimeSpan&) = default;
103
106 constexpr TimeSpan& operator=(const TimeSpan&) = default;
107
111 static constexpr TimeSpan FromTicks(int64_t ticks)
112 {
113 return TimeSpan(ticks);
114 }
115
119 static TimeSpan FromMilliseconds(double value)
120 {
121 return Interval(value, 1);
122 }
123
127 static TimeSpan FromSeconds(double value)
128 {
129 constexpr int MillisecondsPerSecond = 1000;
130 return Interval(value, MillisecondsPerSecond);
131 }
132
136 static TimeSpan FromMinutes(double value)
137 {
138 constexpr int MillisecondsPerMinute = 60 * 1000;
139 return Interval(value, MillisecondsPerMinute);
140 }
141
145 static TimeSpan FromHours(double value)
146 {
147 constexpr int MillisecondsPerHour = 60 * 60 * 1000;
148 return Interval(value, MillisecondsPerHour);
149 }
150
154 static TimeSpan FromDays(double value)
155 {
156 constexpr int MillisecondsPerDay = 24 * 60 * 60 * 1000;
157 return Interval(value, MillisecondsPerDay);
158 }
159
164 static constexpr int Compare(TimeSpan t1, TimeSpan t2)
165 {
166 if (t1.m_ticks > t2.m_ticks) return 1;
167 if (t1.m_ticks < t2.m_ticks) return -1;
168 return 0;
169 }
170
174 constexpr int CompareTo(TimeSpan value) const
175 {
176 return Compare(*this, value);
177 }
178
182 ASPOSECPP_SHARED_API int CompareTo(const SharedPtr<Object>& obj) const;
183
187 constexpr bool Equals(TimeSpan value) const
188 {
189 return m_ticks == value.m_ticks;
190 }
191
195 ASPOSECPP_SHARED_API bool Equals(const SharedPtr<Object>& obj) const;
196
198 static constexpr bool Equals(TimeSpan a, TimeSpan b)
199 {
200 return a.m_ticks == b.m_ticks;
201 }
202
204 ASPOSECPP_SHARED_API int GetHashCode() const;
205
207 constexpr int get_Days() const
208 {
209 return static_cast<int>(m_ticks / TicksPerDay);
210 }
211
213 constexpr int get_Hours() const
214 {
215 return static_cast<int>((m_ticks / TicksPerHour) % 24);
216 }
217
219 constexpr int get_Minutes() const
220 {
221 return static_cast<int>((m_ticks / TicksPerMinute) % 60);
222 }
223
225 constexpr int get_Seconds() const
226 {
227 return static_cast<int>((m_ticks / TicksPerSecond) % 60);
228 }
229
231 constexpr int get_Milliseconds() const
232 {
233 return static_cast<int>((m_ticks / TicksPerMillisecond) % 1000);
234 }
235
237 constexpr int64_t get_Ticks() const
238 {
239 return m_ticks;
240 }
241
243 constexpr double get_TotalDays() const
244 {
245 return static_cast<double>(m_ticks) / TicksPerDay;
246 }
247
249 constexpr double get_TotalHours() const
250 {
251 return static_cast<double>(m_ticks) / TicksPerHour;
252 }
253
255 constexpr double get_TotalMinutes() const
256 {
257 return static_cast<double>(m_ticks) / TicksPerMinute;
258 }
259
261 constexpr double get_TotalSeconds() const
262 {
263 return static_cast<double>(m_ticks) / TicksPerSecond;
264 }
265
267 ASPOSECPP_SHARED_API double get_TotalMilliseconds() const;
268
272 ASPOSECPP_SHARED_API TimeSpan Add(TimeSpan value) const;
273
277 ASPOSECPP_SHARED_API TimeSpan Subtract(TimeSpan value) const;
278
280 ASPOSECPP_SHARED_API TimeSpan Negate() const;
281
283 ASPOSECPP_SHARED_API TimeSpan Duration() const;
284
286 ASPOSECPP_SHARED_API String ToString() const;
287
289 ASPOSECPP_SHARED_API String ToString(const String& format) const;
290
292 ASPOSECPP_SHARED_API String ToString(const String& format, const SharedPtr<IFormatProvider>& provider) const;
293 // Optimized function overloads
294 ASPOSECPP_SHARED_API String ToString(const String& format, const SharedPtr<Globalization::CultureInfo>& culture) const;
295 ASPOSECPP_SHARED_API String ToString(const String& format, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi) const;
296 String ToString(const String& format, std::nullptr_t) const { return ToString(format); }
297
301 static ASPOSECPP_SHARED_API TimeSpan Parse(const String& input);
302
307 static ASPOSECPP_SHARED_API TimeSpan Parse(const String& input, const SharedPtr<IFormatProvider>& provider);
308 // Optimized function overloads
309 static ASPOSECPP_SHARED_API TimeSpan Parse(const String& input, const SharedPtr<Globalization::CultureInfo>& culture);
310 static ASPOSECPP_SHARED_API TimeSpan Parse(const String& input, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi);
311 static TimeSpan Parse(const String& input, std::nullptr_t) { return Parse(input); }
312
319 static ASPOSECPP_SHARED_API TimeSpan ParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<IFormatProvider>& provider, Globalization::TimeSpanStyles styles = Globalization::TimeSpanStyles::None);
320 // Optimized function overloads
323 static ASPOSECPP_SHARED_API TimeSpan ParseExact(const String& input, const ArrayPtr<String>& formats, std::nullptr_t, Globalization::TimeSpanStyles styles = Globalization::TimeSpanStyles::None);
324
331 static ASPOSECPP_SHARED_API TimeSpan ParseExact(const String& input, const String& format, const SharedPtr<IFormatProvider>& provider, Globalization::TimeSpanStyles styles = Globalization::TimeSpanStyles::None);
332 // Optimized function overloads
333 static ASPOSECPP_SHARED_API TimeSpan ParseExact(const String& input, const String& format, const SharedPtr<Globalization::CultureInfo>& culture, Globalization::TimeSpanStyles styles = Globalization::TimeSpanStyles::None);
335 static ASPOSECPP_SHARED_API TimeSpan ParseExact(const String& input, const String& format, std::nullptr_t, Globalization::TimeSpanStyles styles = Globalization::TimeSpanStyles::None);
336
341 static ASPOSECPP_SHARED_API bool TryParse(const String& input, TimeSpan& result);
342
348 static ASPOSECPP_SHARED_API bool TryParse(const String& input, const SharedPtr<IFormatProvider>& provider, TimeSpan& result);
349 // Optimized function overloads
350 static ASPOSECPP_SHARED_API bool TryParse(const String& input, const SharedPtr<Globalization::CultureInfo>& culture, TimeSpan& result);
351 static ASPOSECPP_SHARED_API bool TryParse(const String& input, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi, TimeSpan& result);
352 static ASPOSECPP_SHARED_API bool TryParse(const String& input, std::nullptr_t, TimeSpan& result);
353
360 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<IFormatProvider>& provider, TimeSpan& result);
361 // Optimized function overloads
362 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<Globalization::CultureInfo>& culture, TimeSpan& result);
363 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi, TimeSpan& result);
364 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, std::nullptr_t, TimeSpan& result);
365
373 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, const SharedPtr<IFormatProvider>& provider, Globalization::TimeSpanStyles styles, TimeSpan& result);
374 // Optimized function overloads
375 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, const SharedPtr<Globalization::CultureInfo>& culture, Globalization::TimeSpanStyles styles, TimeSpan& result);
376 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi, Globalization::TimeSpanStyles styles, TimeSpan& result);
377 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, std::nullptr_t, Globalization::TimeSpanStyles styles, TimeSpan& result);
378
386 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<IFormatProvider>& provider, Globalization::TimeSpanStyles styles, TimeSpan& result);
387 // Optimized function overloads
388 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<Globalization::CultureInfo>& culture, Globalization::TimeSpanStyles styles, TimeSpan& result);
389 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi, Globalization::TimeSpanStyles styles, TimeSpan& result);
390 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const ArrayPtr<String>& formats, std::nullptr_t, Globalization::TimeSpanStyles styles, TimeSpan& result);
391
398 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, const SharedPtr<IFormatProvider>& provider, TimeSpan& result);
399 // Optimized function overloads
400 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, const SharedPtr<Globalization::CultureInfo>& culture, TimeSpan& result);
401 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, const SharedPtr<Globalization::DateTimeFormatInfo>& dtfi, TimeSpan& result);
402 static ASPOSECPP_SHARED_API bool TryParseExact(const String& input, const String& format, std::nullptr_t, TimeSpan& result);
403
408 {
409 return Add(value);
410 }
411
416 {
417 return *this = Add(value);
418 }
419
424 {
425 return Subtract(value);
426 }
427
432 {
433 return *this = Subtract(value);
434 }
435
438 {
439 return Negate();
440 }
441
444 {
445 return *this;
446 }
447
448 ASPOSECPP_SHARED_API TimeSpan operator/(double divisor) const;
449
450 TimeSpan& operator/=(double divisor)
451 {
452 return *this = operator/(divisor);
453 }
454
455 constexpr double operator/(TimeSpan value) const
456 {
457 return m_ticks / static_cast<double>(value.m_ticks);
458 }
459
463 constexpr bool operator==(TimeSpan value) const
464 {
465 return m_ticks == value.m_ticks;
466 }
467
471 constexpr bool operator!=(TimeSpan value) const
472 {
473 return m_ticks != value.m_ticks;
474 }
475
479 constexpr bool operator<(TimeSpan value) const
480 {
481 return m_ticks < value.m_ticks;
482 }
483
487 constexpr bool operator<=(TimeSpan value) const
488 {
489 return m_ticks <= value.m_ticks;
490 }
491
495 constexpr bool operator>(TimeSpan value) const
496 {
497 return m_ticks > value.m_ticks;
498 }
499
503 constexpr bool operator>=(TimeSpan value) const
504 {
505 return m_ticks >= value.m_ticks;
506 }
507
509 static const TypeInfo& Type()
510 {
511 return *static_holder<ThisTypeInfo>();
512 }
513
514 constexpr bool IsNull() const { return false; }
515 constexpr bool operator==(std::nullptr_t) const { return false; }
516 constexpr bool operator!=(std::nullptr_t) const { return true; }
517 constexpr bool operator<(std::nullptr_t) const { return false; }
518 constexpr bool operator<=(std::nullptr_t) const { return false; }
519 constexpr bool operator>(std::nullptr_t) const { return false; }
520 constexpr bool operator>=(std::nullptr_t) const { return false; }
521
522private:
524 int64_t m_ticks;
525
527 struct ThisTypeInfo : TypeInfoPtr
528 {
530 ThisTypeInfo()
531 : TypeInfoPtr(u"System::TimeSpan")
532 {}
533 };
534
539 static ASPOSECPP_SHARED_API TimeSpan Interval(double value, int scale);
540
541#if defined(_DEBUG) && defined(_MSC_VER)
542 struct NatvisHelpers
543 {
544 struct Days { int64_t ticks; };
545 struct HoursMinutes { int64_t ticks; };
546 struct HoursMinutesSeconds { int64_t ticks; };
547 struct Fraction { int64_t ticks; };
548 };
549#endif
550
551}; // class TimeSpan
552
553constexpr bool operator==(std::nullptr_t, TimeSpan) { return false; }
554constexpr bool operator!=(std::nullptr_t, TimeSpan) { return true; }
555constexpr bool operator<(std::nullptr_t, TimeSpan) { return false; }
556constexpr bool operator<=(std::nullptr_t, TimeSpan) { return false; }
557constexpr bool operator>(std::nullptr_t, TimeSpan) { return false; }
558constexpr bool operator>=(std::nullptr_t, TimeSpan) { return false; }
559
562template<> struct IsBoxable<TimeSpan> : std::true_type {};
564
566ASPOSECPP_SHARED_API void PrintTo(TimeSpan value, std::ostream* stream);
567
572inline std::ostream& operator<<(std::ostream& stream, TimeSpan time_span)
573{
574 stream << time_span.ToString();
575 return stream;
576}
577
582inline std::wostream& operator<<(std::wostream& stream, TimeSpan time_span)
583{
584 stream << time_span.ToString();
585 return stream;
586}
587
588} // namespace System
589
590namespace std {
591 template <>
592 class hash<System::TimeSpan>
593 {
594 public:
595 using argument_type = System::TimeSpan;
596 using result_type = std::size_t;
597
598 result_type operator()(argument_type value) const
599 {
600 return static_cast<result_type>(value.GetHashCode());
601 }
602 };
603}
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Represents a time interval. This type should be allocated on stack and passed to functions by value o...
Definition: timespan.h:59
constexpr bool IsNull() const
Definition: timespan.h:514
TimeSpan Negate() const
Returns a new instance of TimeSpan object that represents negated value represented by the current Ti...
constexpr double get_TotalHours() const
Returns the value of the current TimeSpan object expressed in whole and fractional hours.
Definition: timespan.h:249
TimeSpan(int hours, int minutes, int seconds)
Constructs an instance of TimeSpan class that represents the time interval which is equal to the sum ...
static bool TryParseExact(const String &input, const String &format, std::nullptr_t, Globalization::TimeSpanStyles styles, TimeSpan &result)
constexpr double operator/(TimeSpan value) const
Definition: timespan.h:455
static TimeSpan ParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
static TimeSpan Parse(const String &input, std::nullptr_t)
Definition: timespan.h:311
TimeSpan Subtract(TimeSpan value) const
Returns a new instance of TimeSpan class that represents a time interval which is the result of subtr...
static bool TryParseExact(const String &input, const String &format, std::nullptr_t, TimeSpan &result)
constexpr bool operator<(std::nullptr_t) const
Definition: timespan.h:517
constexpr bool Equals(TimeSpan value) const
Determines if the time interval represented by the current object is equal to the time interval repre...
Definition: timespan.h:187
static TimeSpan FromHours(double value)
Returns a new TimeSpan object that represents the specified interval.
Definition: timespan.h:145
String ToString(const String &format, std::nullptr_t) const
Definition: timespan.h:296
TimeSpan & operator+=(TimeSpan value)
Assigns to the current object the time interval which is the sum of the time interval represented by ...
Definition: timespan.h:415
TimeSpan Duration() const
Returns a new instance of TimeSpan object whose value is the absolute value of the current object.
static TimeSpan ParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
Converts string to equivalent TimeSpan object using the specified formats, format provider and styles...
static TimeSpan ParseExact(const String &input, const ArrayPtr< String > &formats, std::nullptr_t, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
static TimeSpan Parse(const String &input, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi)
TimeSpan & operator/=(double divisor)
Definition: timespan.h:450
static bool TryParseExact(const String &input, const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, TimeSpan &result)
static TimeSpan ParseExact(const String &input, const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
constexpr TimeSpan & operator=(const TimeSpan &)=default
Sets the time interval represented by the specified TimeSpan object to the current TimeSpan object.
TimeSpan Add(TimeSpan value) const
Returns a new instance of TimeSpan class that represents a time interval which is the sum of the time...
String ToString() const
Returns the string representation of the time interval represented by the current object.
constexpr bool operator>(TimeSpan value) const
Determines if the time interval represented by the current object is longer than the time interval re...
Definition: timespan.h:495
static TimeSpan FromSeconds(double value)
Returns a new TimeSpan object that represents the specified interval.
Definition: timespan.h:127
constexpr bool operator==(TimeSpan value) const
Determines if the time interval represented by the current object is equal to the time interval repre...
Definition: timespan.h:463
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::TimeSpanStyles styles, TimeSpan &result)
constexpr double get_TotalDays() const
Returns the value of the current TimeSpan object expressed in whole and fractional days.
Definition: timespan.h:243
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< Globalization::CultureInfo > &culture, TimeSpan &result)
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, std::nullptr_t, TimeSpan &result)
static constexpr bool Equals(TimeSpan a, TimeSpan b)
Returns true if the specified objects represent the same time interval, otherwise - false.
Definition: timespan.h:198
TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds=0)
Constructs an instance of TimeSpan class that represents the time interval which is equal to the sum ...
constexpr TimeSpan()
Constructs a TimeSpan object that represents a zero time interval.
Definition: timespan.h:80
static const TimeSpan Zero
The TimeSpan object that represents zero-interval.
Definition: timespan.h:62
double get_TotalMilliseconds() const
Returns the value of the current TimeSpan object expressed in whole and fractional milliseconds.
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, Globalization::TimeSpanStyles styles, TimeSpan &result)
Converts string to equivalent TimeSpan object using the specified formats, format provider and styles...
static const TimeSpan MinValue
/// The TimeSpan object that represents the shortest possible interval.
Definition: timespan.h:66
static bool TryParseExact(const String &input, const String &format, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::TimeSpanStyles styles, TimeSpan &result)
constexpr bool operator<=(TimeSpan value) const
Determines if the time interval represented by the current object is shorter than or equal to the tim...
Definition: timespan.h:487
constexpr int CompareTo(TimeSpan value) const
Compares current and the specified objects.
Definition: timespan.h:174
constexpr bool operator>=(TimeSpan value) const
Determines if the time interval represented by the current object is longer than or equal to the time...
Definition: timespan.h:503
static TimeSpan ParseExact(const String &input, const String &format, std::nullptr_t, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
static constexpr TimeSpan FromTicks(int64_t ticks)
Returns a new TimeSpan object that represents the specified interval.
Definition: timespan.h:111
String ToString(const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi) const
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, TimeSpan &result)
constexpr bool operator!=(std::nullptr_t) const
Definition: timespan.h:516
static TimeSpan Parse(const String &input, const SharedPtr< Globalization::CultureInfo > &culture)
static TimeSpan Parse(const String &input)
Converts string to equivalent TimeSpan object.
TimeSpan operator+(TimeSpan value) const
Returns a new instance of TimeSpan class that represents a time interval which is the sum of the time...
Definition: timespan.h:407
static bool TryParse(const String &input, TimeSpan &result)
Converts string to equivalent TimeSpan object and returns result of conversion.
static bool TryParseExact(const String &input, const String &format, const SharedPtr< Globalization::CultureInfo > &culture, TimeSpan &result)
constexpr int get_Minutes() const
Returns the minutes component of the time interval represented by the current TimeSpan object.
Definition: timespan.h:219
constexpr double get_TotalSeconds() const
Returns the value of the current TimeSpan object expressed in whole and fractional seconds.
Definition: timespan.h:261
constexpr int64_t get_Ticks() const
Returns the number of 100-nanoseconds intervals that constitute the time interval represented by the ...
Definition: timespan.h:237
String ToString(const String &format) const
Converts the value of the current object to equivalent string representation, using the specified for...
TimeSpan operator-() const
Returns a new instance of TimeSpan object that represents negated value represented by the current Ti...
Definition: timespan.h:437
constexpr bool operator<=(std::nullptr_t) const
Definition: timespan.h:518
int CompareTo(const SharedPtr< Object > &obj) const
Compares current and the specified objects.
static TimeSpan FromDays(double value)
Returns a new TimeSpan object that represents the specified interval.
Definition: timespan.h:154
constexpr bool operator>(std::nullptr_t) const
Definition: timespan.h:519
static bool TryParseExact(const String &input, const String &format, const SharedPtr< IFormatProvider > &provider, TimeSpan &result)
Converts string to equivalent TimeSpan object using the specified format and format provider,...
static const TypeInfo & Type()
Returns a TypeInfo object that represent TimeSpan structure.
Definition: timespan.h:509
static bool TryParse(const String &input, const SharedPtr< IFormatProvider > &provider, TimeSpan &result)
Converts string to equivalent TimeSpan object using the specified format provider and returns result ...
constexpr int get_Hours() const
Returns the hours component of the time interval represented by the current TimeSpan object.
Definition: timespan.h:213
static TimeSpan Parse(const String &input, const SharedPtr< IFormatProvider > &provider)
Converts string to equivalent TimeSpan object using the specified format provider.
static const TimeSpan MaxValue
The TimeSpan object that represents the longest possible interval.
Definition: timespan.h:64
TimeSpan operator-(TimeSpan value) const
Returns a new instance of TimeSpan class that represents a time interval which is the result of subtr...
Definition: timespan.h:423
TimeSpan operator+() const
Returns self.
Definition: timespan.h:443
constexpr TimeSpan(const TimeSpan &)=default
Constructs a TimeSpan object that represents the time interval equal to the time interval represented...
constexpr bool operator>=(std::nullptr_t) const
Definition: timespan.h:520
TimeSpan & operator-=(TimeSpan value)
Assigns to the current object the time interval which is the result of subtraction of the time interv...
Definition: timespan.h:431
constexpr bool operator!=(TimeSpan value) const
Determines if the time interval represented by the current object is not equal to the time interval r...
Definition: timespan.h:471
int GetHashCode() const
Returns a hash code for the current object.
constexpr double get_TotalMinutes() const
Returns the value of the current TimeSpan object expressed in whole and fractional minutes.
Definition: timespan.h:255
static TimeSpan ParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::TimeSpanStyles styles, TimeSpan &result)
String ToString(const String &format, const SharedPtr< IFormatProvider > &provider) const
Converts the value of the current object to equivalent string representation, using the specified for...
String ToString(const String &format, const SharedPtr< Globalization::CultureInfo > &culture) const
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, TimeSpan &result)
Converts string to equivalent TimeSpan object using the specified formats and format provider,...
constexpr int get_Days() const
Returns the days component of the time interval represented by the current TimeSpan object.
Definition: timespan.h:207
constexpr TimeSpan(int64_t ticks)
Constructs an instance of TimeSpan class that represents the specified time interval.
Definition: timespan.h:85
static TimeSpan ParseExact(const String &input, const String &format, const SharedPtr< IFormatProvider > &provider, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
Converts string to equivalent TimeSpan object using the specified format, format provider and styles.
static TimeSpan FromMilliseconds(double value)
Returns a new TimeSpan object that represents the specified interval.
Definition: timespan.h:119
static bool TryParse(const String &input, const SharedPtr< Globalization::CultureInfo > &culture, TimeSpan &result)
static TimeSpan ParseExact(const String &input, const String &format, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::TimeSpanStyles styles=Globalization::TimeSpanStyles::None)
static bool TryParseExact(const String &input, const ArrayPtr< String > &formats, std::nullptr_t, Globalization::TimeSpanStyles styles, TimeSpan &result)
static bool TryParse(const String &input, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, TimeSpan &result)
static bool TryParseExact(const String &input, const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::TimeSpanStyles styles, TimeSpan &result)
static bool TryParseExact(const String &input, const String &format, const SharedPtr< IFormatProvider > &provider, Globalization::TimeSpanStyles styles, TimeSpan &result)
Converts string to equivalent TimeSpan object using the specified format, format provider and styles,...
static bool TryParse(const String &input, std::nullptr_t, TimeSpan &result)
constexpr bool operator==(std::nullptr_t) const
Definition: timespan.h:515
constexpr int get_Milliseconds() const
Returns the milliseconds component of the time interval represented by the current TimeSpan object.
Definition: timespan.h:231
static TimeSpan FromMinutes(double value)
Returns a new TimeSpan object that represents the specified interval.
Definition: timespan.h:136
static constexpr int Compare(TimeSpan t1, TimeSpan t2)
Compares two TimeSpan objects.
Definition: timespan.h:164
bool Equals(const SharedPtr< Object > &obj) const
Determines if the time interval represented by the current object is equal to the time interval repre...
constexpr int get_Seconds() const
Returns the seconds component of the time interval represented by the current TimeSpan object.
Definition: timespan.h:225
constexpr bool operator<(TimeSpan value) const
Determines if the time interval represented by the current object is shorter than the time interval r...
Definition: timespan.h:479
TimeSpan operator/(double divisor) const
Represents a particular type and provides information about it.
Definition: type_info.h:109
TimeSpanStyles
Specifies the formatting options that customize string parsing for methods that convert a string repr...
Definition: time_span_styles.h:12
@ None
The time interval represented by the inptut string is interpreted as a negative time interval only if...
Definition: db_command.h:9
void PrintTo(DateTime value, std::ostream *stream)
Prints value to ostream. Mostly used for debug.
std::enable_if_t<!std::is_floating_point< TA >::value &&!std::is_floating_point< TB >::value, int > Compare(const TA &a, const TB &b)
Compares two values.
Definition: primitive_types.h:113
bool operator!=(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:157
Decimal operator/(const T &x, const Decimal &d)
Returns a new instance of Decimal class that represents a value that is a result of division of the s...
Definition: decimal.h:563
constexpr bool operator>(std::nullptr_t, DateTime)
Definition: date_time.h:714
std::ostream & operator<<(std::ostream &stream, DateTime date_time)
Insert data into the stream using UTF-8 encoding.
Definition: date_time.h:729
constexpr bool operator<(std::nullptr_t, DateTime)
Definition: date_time.h:712
constexpr bool operator<=(std::nullptr_t, DateTime)
Definition: date_time.h:713
constexpr bool operator>=(std::nullptr_t, DateTime)
Definition: date_time.h:715
bool operator==(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:151
Wrapper for a pointer to an instance of TypeInfo class. This type should be allocated on stack and pa...
Definition: type_info.h:72