Asposecpplib

Represents a time interval. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type. More...

Public Member Functions

ASPOSECPP_SHARED_API TimeSpan (int64_t dotnetTicks)
 Constructs an instance of TimeSpan class that represents the specified time interval. More...
 
ASPOSECPP_SHARED_API TimeSpan (int hours, int minutes, int seconds)
 Constructs an instance of TimeSpan class that represents the time interval which is equal to the sum of the specified numebr of hours, minutes and seconds. More...
 
ASPOSECPP_SHARED_API 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 of the specified numebr of hours, minutes, seconds and milliseconds. More...
 
ASPOSECPP_SHARED_API TimeSpan ()
 Constructs a TimeSpan object that represents a zero time interval. More...
 
ASPOSECPP_SHARED_API TimeSpan (const TimeSpan &span)
 Constructs a TimeSpan object that represents the time interval equal to the time interval represented by the specified TimeSpan object. More...
 
ASPOSECPP_SHARED_API ~TimeSpan ()
 Destructor. More...
 
ASPOSECPP_SHARED_API TimeSpanoperator= (const TimeSpan &ts)
 Sets the time interval represented by the specified TimeSpan object to the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API int get_Days () const
 Returns the days component of the time interval represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API int get_Hours () const
 Returns the hours component of the time interval represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API int get_Minutes () const
 Returns the minutes component of the time interval represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API int get_Seconds () const
 Returns the seconds component of the time interval represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API int get_Milliseconds () const
 Returns the milliseconds component of the time interval represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API int64_t get_Ticks () const
 Returns the number of 100-nanoseconds intervals that constitute the time interval represented by the current TimeSpan object. More...
 
double get_TotalDays () const
 Returns the value of the current TimeSpan object expressed in whole and fractional days. More...
 
double get_TotalHours () const
 Returns the value of the current TimeSpan object expressed in whole and fractional hours. More...
 
double get_TotalMinutes () const
 Returns the value of the current TimeSpan object expressed in whole and fractional minutes. More...
 
double get_TotalSeconds () const
 Returns the value of the current TimeSpan object expressed in whole and fractional seconds. More...
 
ASPOSECPP_SHARED_API double get_TotalMilliseconds () const
 Returns the value of the current TimeSpan object expressed in whole and fractional milliseconds. More...
 
ASPOSECPP_SHARED_API TimeSpan Add (TimeSpan value) const
 Returns a new instance of TimeSpan class that represents a time interval which is the sum of the time intervals represented by the current and the specified objects. More...
 
ASPOSECPP_SHARED_API TimeSpan Subtract (TimeSpan value) const
 Returns a new instance of TimeSpan class that represents a time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object. More...
 
ASPOSECPP_SHARED_API TimeSpan Negate ()
 Returns a new instance of TimeSpan object that represents negated value represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API String ToString () const
 Returns the string representation of the time interval represented by the current object. More...
 
ASPOSECPP_SHARED_API double ToDouble () const
 Returns the number of 100-nanoseconds intervals that constitute the time interval value represented by the current object as a double-precision floating point number. More...
 
ASPOSECPP_SHARED_API bool Equals (const TimeSpan &value) const
 Determines if the time interval represented by the current object is equal to the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API int CompareTo (const TimeSpan &value) const
 Compares current and the specified objects. More...
 
ASPOSECPP_SHARED_API int GetHashCode () const
 Returns a hash code for the current object. More...
 
TimeSpan operator+ (const TimeSpan &value) const
 Returns a new instance of TimeSpan class that represents a time interval which is the sum of the time intervals represented by the current and the specified objects. More...
 
ASPOSECPP_SHARED_API TimeSpanoperator+= (const TimeSpan &value)
 Assigns to the current object the time interval which is the sum of the time interval represented by the current and the specified objects. More...
 
TimeSpan operator- (const TimeSpan &value) const
 Returns a new instance of TimeSpan class that represents a time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object. More...
 
ASPOSECPP_SHARED_API TimeSpanoperator-= (const TimeSpan &value)
 Assigns to the current object the time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object. More...
 
ASPOSECPP_SHARED_API bool operator== (const TimeSpan &value) const
 Determines if the time interval represented by the current object is equal to the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API bool operator!= (const TimeSpan &value) const
 Determines if the time interval represented by the current object is not equal to the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API bool operator< (const TimeSpan &value) const
 Determines if the time interval represented by the current object is shorter than the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API bool operator<= (const TimeSpan &value) const
 Determines if the time interval represented by the current object is shorter than or equal to the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API bool operator> (const TimeSpan &value) const
 Determines if the time interval represented by the current object is longer than the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API bool operator>= (const TimeSpan &value) const
 Determines if the time interval represented by the current object is longer than or equal to the time interval represented by the specified object. More...
 
ASPOSECPP_SHARED_API TimeSpan operator- () const
 Returns a new instance of TimeSpan object that represents negated value represented by the current TimeSpan object. More...
 
ASPOSECPP_SHARED_API TimeSpan (boost::posix_time::time_duration td)
 Construct an instance of TimeSpan class that represents the specified time interval. More...
 

Static Public Member Functions

static ASPOSECPP_SHARED_API TimeSpan Interval (double value, int scale)
 Constructs TimeSpan value of value * scale milliseconds. More...
 
static ASPOSECPP_SHARED_API TimeSpan Parse (const String &str)
 Converts the string representation of a time interval to equivalent TimeSpan object. More...
 
static TimeSpan FromTicks (int64_t ticks)
 Returns a new TimeSpan object that represents the specified interval. More...
 
static TimeSpan FromMilliseconds (double value)
 Returns a new TimeSpan object that represents the specified interval. More...
 
static TimeSpan FromSeconds (double value)
 Returns a new TimeSpan object that represents the specified interval. More...
 
static TimeSpan FromMinutes (double value)
 Returns a new TimeSpan object that represents the specified interval. More...
 
static TimeSpan FromHours (double value)
 Returns a new TimeSpan object that represents the specified interval. More...
 
static TimeSpan FromDays (double value)
 Returns a new TimeSpan object that represents the specified interval. More...
 
static int Compare (const TimeSpan &t1, const TimeSpan &t2)
 Compares two TimeSpan objects. More...
 
static const TypeInfoType ()
 Returns a TypeInfo object that represent TimeSpan structure. More...
 

Static Public Attributes

static const int ASPOSECPP_SHARED_API SEC_PER_DAY = 24 * 60 * 60
 The number of seconds in a day (24-hour interval). More...
 
static const int ASPOSECPP_SHARED_API SEC_PER_H = 24 * 60
 The number of seconds in a hour. More...
 
static const int ASPOSECPP_SHARED_API SEC_PER_M = 60
 The number of seconds in a minute. More...
 
static const TimeSpan ASPOSECPP_SHARED_API Zero
 The TimeSpan object that represents zero-interval. More...
 
static const TimeSpan ASPOSECPP_SHARED_API MaxValue
 The TimeSpan object that represents the longest possible interval. More...
 
static const TimeSpan ASPOSECPP_SHARED_API MinValue
 /// The TimeSpan object that represents the shortest possible interval. More...
 
static constexpr int64_t TicksPerDay = 864000000000ULL
 The number of 100-nanoseconds intervals in a day (24-hour interval). More...
 
static constexpr int64_t TicksPerHour = 36000000000ULL
 The number of 100-nanoseconds intervals in a hour. More...
 
static constexpr int64_t TicksPerMillisecond = 10000ULL
 The number of 100-nanoseconds intervals in a millisecond. More...
 
static constexpr int64_t TicksPerMinute = 600000000ULL
 The number of 100-nanoseconds intervals in a minute. More...
 
static constexpr int64_t TicksPerSecond = 10000000ULL
 The number of 100-nanoseconds intervals in a second. More...
 

Detailed Description

Represents a time interval. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

Constructor & Destructor Documentation

◆ TimeSpan() [1/6]

ASPOSECPP_SHARED_API System::TimeSpan::TimeSpan ( int64_t  dotnetTicks)

Constructs an instance of TimeSpan class that represents the specified time interval.

Parameters
dotnetTicksThe time interval to be represented by the instance being constructed expressed as the number of 100-nanoseconds intervals.

◆ TimeSpan() [2/6]

ASPOSECPP_SHARED_API System::TimeSpan::TimeSpan ( int  hours,
int  minutes,
int  seconds 
)

Constructs an instance of TimeSpan class that represents the time interval which is equal to the sum of the specified numebr of hours, minutes and seconds.

Parameters
hoursThe number of hours in the hours component of the time interval to be represented by the instance being constructed
minutesThe number of minutes in the minutes component of the time interval to be represented by the instance being constructed
secondsThe number of seconds in the seconds component of the time interval to be represented by the instance being constructed

◆ TimeSpan() [3/6]

ASPOSECPP_SHARED_API System::TimeSpan::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 of the specified numebr of hours, minutes, seconds and milliseconds.

Parameters
daysThe number of days in the days component of the time interval to be represented by the instance being constructed
hoursThe number of hours in the hours component of the time interval to be represented by the instance being constructed
minutesThe number of minutes in the minutes component of the time interval to be represented by the instance being constructed
secondsThe number of seconds in the seconds component of the time interval to be represented by the instance being constructed
millisecondsThe number of milliseconds in the milliseconds component of the time interval to be represented by the instance being constructed

◆ TimeSpan() [4/6]

ASPOSECPP_SHARED_API System::TimeSpan::TimeSpan ( )

Constructs a TimeSpan object that represents a zero time interval.

◆ TimeSpan() [5/6]

ASPOSECPP_SHARED_API System::TimeSpan::TimeSpan ( const TimeSpan span)

Constructs a TimeSpan object that represents the time interval equal to the time interval represented by the specified TimeSpan object.

Parameters
spanThe TimeSpan object to copy the time interval from

◆ ~TimeSpan()

ASPOSECPP_SHARED_API System::TimeSpan::~TimeSpan ( )

Destructor.

◆ TimeSpan() [6/6]

ASPOSECPP_SHARED_API System::TimeSpan::TimeSpan ( boost::posix_time::time_duration  td)
explicit

Construct an instance of TimeSpan class that represents the specified time interval.

Parameters
tdThe time interval to be represented by the instance being constructed

Member Function Documentation

◆ Add()

ASPOSECPP_SHARED_API TimeSpan System::TimeSpan::Add ( TimeSpan  value) const

Returns a new instance of TimeSpan class that represents a time interval which is the sum of the time intervals represented by the current and the specified objects.

Parameters
valueThe TimeSpan object that represents the time interval to add
Returns
A new instance of TimeSpan class that represents a time interval which is the sum of the time intervals represented by the current and the specified objects.

◆ Compare()

static int System::TimeSpan::Compare ( const TimeSpan t1,
const TimeSpan t2 
)
inlinestatic

Compares two TimeSpan objects.

Parameters
t1The first comparand
t2The second comparand
Returns
-1 if t1 is shorter than t2; 0 if t1 is equal to t2; 1 if t1 is longer than t2

◆ CompareTo()

ASPOSECPP_SHARED_API int System::TimeSpan::CompareTo ( const TimeSpan value) const

Compares current and the specified objects.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
-1 if the current object represents the interval that is than value; 0 if the current object represents the interval that is equal to value; 1 if the current object represents the interval that is longer than value

◆ Equals()

ASPOSECPP_SHARED_API bool System::TimeSpan::Equals ( const TimeSpan value) const

Determines if the time interval represented by the current object is equal to the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the current object and the specified object represent the same time interval, otherwise - false

◆ FromDays()

static TimeSpan System::TimeSpan::FromDays ( double  value)
inlinestatic

Returns a new TimeSpan object that represents the specified interval.

Parameters
valueThe time interval expressed as the number of days.
Returns
A new TimeSpan object that represents the specified interval.

◆ FromHours()

static TimeSpan System::TimeSpan::FromHours ( double  value)
inlinestatic

Returns a new TimeSpan object that represents the specified interval.

Parameters
valueThe time interval expressed as the number of hours.
Returns
A new TimeSpan object that represents the specified interval.

◆ FromMilliseconds()

static TimeSpan System::TimeSpan::FromMilliseconds ( double  value)
inlinestatic

Returns a new TimeSpan object that represents the specified interval.

Parameters
valueThe time interval expressed as the number of milliseconds.
Returns
A new TimeSpan object that represents the specified interval.

◆ FromMinutes()

static TimeSpan System::TimeSpan::FromMinutes ( double  value)
inlinestatic

Returns a new TimeSpan object that represents the specified interval.

Parameters
valueThe time interval expressed as the number of minutes.
Returns
A new TimeSpan object that represents the specified interval.

◆ FromSeconds()

static TimeSpan System::TimeSpan::FromSeconds ( double  value)
inlinestatic

Returns a new TimeSpan object that represents the specified interval.

Parameters
valueThe time interval expressed as the number of seconds.
Returns
A new TimeSpan object that represents the specified interval.

◆ FromTicks()

static TimeSpan System::TimeSpan::FromTicks ( int64_t  ticks)
inlinestatic

Returns a new TimeSpan object that represents the specified interval.

Parameters
ticksThe time interval expressed as the number of 100-nanoseconds intervals.
Returns
A new TimeSpan object that represents the specified interval.

◆ get_Days()

ASPOSECPP_SHARED_API int System::TimeSpan::get_Days ( ) const

Returns the days component of the time interval represented by the current TimeSpan object.

◆ get_Hours()

ASPOSECPP_SHARED_API int System::TimeSpan::get_Hours ( ) const

Returns the hours component of the time interval represented by the current TimeSpan object.

◆ get_Milliseconds()

ASPOSECPP_SHARED_API int System::TimeSpan::get_Milliseconds ( ) const

Returns the milliseconds component of the time interval represented by the current TimeSpan object.

◆ get_Minutes()

ASPOSECPP_SHARED_API int System::TimeSpan::get_Minutes ( ) const

Returns the minutes component of the time interval represented by the current TimeSpan object.

◆ get_Seconds()

ASPOSECPP_SHARED_API int System::TimeSpan::get_Seconds ( ) const

Returns the seconds component of the time interval represented by the current TimeSpan object.

◆ get_Ticks()

ASPOSECPP_SHARED_API int64_t System::TimeSpan::get_Ticks ( ) const

Returns the number of 100-nanoseconds intervals that constitute the time interval represented by the current TimeSpan object.

◆ get_TotalDays()

double System::TimeSpan::get_TotalDays ( ) const
inline

Returns the value of the current TimeSpan object expressed in whole and fractional days.

◆ get_TotalHours()

double System::TimeSpan::get_TotalHours ( ) const
inline

Returns the value of the current TimeSpan object expressed in whole and fractional hours.

◆ get_TotalMilliseconds()

ASPOSECPP_SHARED_API double System::TimeSpan::get_TotalMilliseconds ( ) const

Returns the value of the current TimeSpan object expressed in whole and fractional milliseconds.

◆ get_TotalMinutes()

double System::TimeSpan::get_TotalMinutes ( ) const
inline

Returns the value of the current TimeSpan object expressed in whole and fractional minutes.

◆ get_TotalSeconds()

double System::TimeSpan::get_TotalSeconds ( ) const
inline

Returns the value of the current TimeSpan object expressed in whole and fractional seconds.

◆ GetHashCode()

ASPOSECPP_SHARED_API int System::TimeSpan::GetHashCode ( ) const

Returns a hash code for the current object.

◆ Interval()

static ASPOSECPP_SHARED_API TimeSpan System::TimeSpan::Interval ( double  value,
int  scale 
)
static

Constructs TimeSpan value of value * scale milliseconds.

Parameters
valueFloating point part.
scaleInteger part.

◆ Negate()

ASPOSECPP_SHARED_API TimeSpan System::TimeSpan::Negate ( )

Returns a new instance of TimeSpan object that represents negated value represented by the current TimeSpan object.

◆ operator!=()

ASPOSECPP_SHARED_API bool System::TimeSpan::operator!= ( const TimeSpan value) const

Determines if the time interval represented by the current object is not equal to the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the current object and the specified object represent different time intervals, otherwise - false

◆ operator+()

TimeSpan System::TimeSpan::operator+ ( const TimeSpan value) const
inline

Returns a new instance of TimeSpan class that represents a time interval which is the sum of the time intervals represented by the current and the specified objects.

Parameters
valueThe TimeSpan object that represents the time interval to add
Returns
A new instance of TimeSpan class that represents a time interval which is the sum of the time intervals represented by the current and the specified objects.

◆ operator+=()

ASPOSECPP_SHARED_API TimeSpan& System::TimeSpan::operator+= ( const TimeSpan value)

Assigns to the current object the time interval which is the sum of the time interval represented by the current and the specified objects.

Parameters
valueThe TimeSpan object that represents the time interval to add
Returns
A reference to the self

◆ operator-() [1/2]

TimeSpan System::TimeSpan::operator- ( const TimeSpan value) const
inline

Returns a new instance of TimeSpan class that represents a time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object.

Parameters
valueThe TimeSpan object that represents the time interval to subtract
Returns
A new instance of TimeSpan class that represents a time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object.

◆ operator-() [2/2]

ASPOSECPP_SHARED_API TimeSpan System::TimeSpan::operator- ( ) const

Returns a new instance of TimeSpan object that represents negated value represented by the current TimeSpan object.

◆ operator-=()

ASPOSECPP_SHARED_API TimeSpan& System::TimeSpan::operator-= ( const TimeSpan value)

Assigns to the current object the time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object.

Parameters
valueThe TimeSpan object that represents the time interval to subtract
Returns
A reference to the self

◆ operator<>

ASPOSECPP_SHARED_API bool System::TimeSpan::operator< ( const TimeSpan value) const

Determines if the time interval represented by the current object is shorter than the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the time interval represented by the current object is shorter than the time interval represented by value, otherwise - false

◆ operator<>

ASPOSECPP_SHARED_API bool System::TimeSpan::operator<= ( const TimeSpan value) const

Determines if the time interval represented by the current object is shorter than or equal to the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the time interval represented by the current object is shorter than or equal to the time interval represented by value, otherwise - false

◆ operator=()

ASPOSECPP_SHARED_API TimeSpan& System::TimeSpan::operator= ( const TimeSpan ts)

Sets the time interval represented by the specified TimeSpan object to the current TimeSpan object.

Parameters
tsThe TimeSpan object to copy the time interval from
Returns
A reference to the self

◆ operator==()

ASPOSECPP_SHARED_API bool System::TimeSpan::operator== ( const TimeSpan value) const

Determines if the time interval represented by the current object is equal to the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the current object and the specified object represent the same time interval, otherwise - false

◆ operator>()

ASPOSECPP_SHARED_API bool System::TimeSpan::operator> ( const TimeSpan value) const

Determines if the time interval represented by the current object is longer than the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the time interval represented by the current object is longer than the time interval represented by value, otherwise - false

◆ operator>=()

ASPOSECPP_SHARED_API bool System::TimeSpan::operator>= ( const TimeSpan value) const

Determines if the time interval represented by the current object is longer than or equal to the time interval represented by the specified object.

Parameters
valueThe TimeSpan object to compare the current object with
Returns
True if the time interval represented by the current object is longer than or equal to the time interval represented by value, otherwise - false

◆ Parse()

static ASPOSECPP_SHARED_API TimeSpan System::TimeSpan::Parse ( const String str)
static

Converts the string representation of a time interval to equivalent TimeSpan object.

Parameters
strThe string representation of a time interval
Returns
A TimeSpan object representing a time interval equivalent to that represented by str

◆ Subtract()

ASPOSECPP_SHARED_API TimeSpan System::TimeSpan::Subtract ( TimeSpan  value) const

Returns a new instance of TimeSpan class that represents a time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object.

Parameters
valueThe TimeSpan object that represents the time interval to subtract
Returns
A new instance of TimeSpan class that represents a time interval which is the result of subtraction of the time interval represented by the specified object from the time interval represented by the current object.

◆ ToDouble()

ASPOSECPP_SHARED_API double System::TimeSpan::ToDouble ( ) const

Returns the number of 100-nanoseconds intervals that constitute the time interval value represented by the current object as a double-precision floating point number.

◆ ToString()

ASPOSECPP_SHARED_API String System::TimeSpan::ToString ( ) const

Returns the string representation of the time interval represented by the current object.

◆ Type()

static const TypeInfo& System::TimeSpan::Type ( )
inlinestatic

Returns a TypeInfo object that represent TimeSpan structure.

Member Data Documentation

◆ MaxValue

const TimeSpan ASPOSECPP_SHARED_API System::TimeSpan::MaxValue
static

The TimeSpan object that represents the longest possible interval.

◆ MinValue

const TimeSpan ASPOSECPP_SHARED_API System::TimeSpan::MinValue
static

/// The TimeSpan object that represents the shortest possible interval.

◆ SEC_PER_DAY

const int ASPOSECPP_SHARED_API System::TimeSpan::SEC_PER_DAY = 24 * 60 * 60
static

The number of seconds in a day (24-hour interval).

◆ SEC_PER_H

const int ASPOSECPP_SHARED_API System::TimeSpan::SEC_PER_H = 24 * 60
static

The number of seconds in a hour.

◆ SEC_PER_M

const int ASPOSECPP_SHARED_API System::TimeSpan::SEC_PER_M = 60
static

The number of seconds in a minute.

◆ TicksPerDay

constexpr int64_t System::TimeSpan::TicksPerDay = 864000000000ULL
static

The number of 100-nanoseconds intervals in a day (24-hour interval).

◆ TicksPerHour

constexpr int64_t System::TimeSpan::TicksPerHour = 36000000000ULL
static

The number of 100-nanoseconds intervals in a hour.

◆ TicksPerMillisecond

constexpr int64_t System::TimeSpan::TicksPerMillisecond = 10000ULL
static

The number of 100-nanoseconds intervals in a millisecond.

◆ TicksPerMinute

constexpr int64_t System::TimeSpan::TicksPerMinute = 600000000ULL
static

The number of 100-nanoseconds intervals in a minute.

◆ TicksPerSecond

constexpr int64_t System::TimeSpan::TicksPerSecond = 10000000ULL
static

The number of 100-nanoseconds intervals in a second.

◆ Zero

const TimeSpan ASPOSECPP_SHARED_API System::TimeSpan::Zero
static

The TimeSpan object that represents zero-interval.