C++ API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Public Static Functions | List of all members
TimeSpan Class Reference

The TimeSpan class represents a duration of time at a resolution of 100 nanoseconds (10e-7 seconds).

Public Functions

TimeSpan Add (TimeSpan const &other) const
 
struct timespec AsTimespec () const
 
struct timeval AsTimeval () const
 
int Compare (TimeSpan const &other) const
 
int Days () const
 
TimeSpan Duration () const
 
double FractionalSeconds () const
 
int Hours () const
 
int Microseconds () const
 
int Milliseconds () const
 
int Minutes () const
 
TimeSpan Negate () const
 
bool operator!= (TimeSpan const &other) const
 
TimeSpan operator+ () const
 
TimeSpan operator+ (TimeSpan const &other) const
 
TimeSpanoperator+= (TimeSpan const &other)
 
TimeSpan operator- () const
 
TimeSpan operator- (TimeSpan const &other) const
 
TimeSpanoperator-= (TimeSpan const &other)
 
bool operator< (TimeSpan const &other) const
 
bool operator<= (TimeSpan const &other) const
 
TimeSpanoperator= (TimeSpan const &other)
 
bool operator== (TimeSpan const &other) const
 
bool operator> (TimeSpan const &other) const
 
bool operator>= (TimeSpan const &other) const
 
int Seconds () const
 
TimeSpan Subtract (TimeSpan const &other) const
 
Int64 Ticks () const
 
String ToString () const
 
double TotalDays () const
 
double TotalHours () const
 
double TotalMilliseconds () const
 
double TotalMinutes () const
 
double TotalSeconds () const
 
Constructors and Destructors
 TimeSpan ()
 
 TimeSpan (Int64 ticks)
 
 TimeSpan (int hours, int minutes, int seconds)
 
 TimeSpan (int days, int hours, int minutes, int seconds, int milliseconds=0)
 
 TimeSpan (TimeSpan const &other)
 
 ~TimeSpan ()
 

Public Static Functions

static TimeSpan FromDays (double value)
 
static TimeSpan FromHours (double value)
 
static TimeSpan FromMicroseconds (Int64 value)
 
static TimeSpan FromMilliseconds (double value)
 
static TimeSpan FromMinutes (double value)
 
static TimeSpan FromSeconds (double value)
 
static TimeSpan FromTicks (Int64 value)
 
static TimeSpan FromTimespec (const struct timespec &value)
 
static TimeSpan FromTimeval (const struct timeval &value)
 
static const TimeSpan MaxValue ()
 
static const TimeSpan MinValue ()
 
static int NanosecondsPerTick ()
 
static Int64 TicksPerDay ()
 
static Int64 TicksPerHour ()
 
static Int64 TicksPerMicrosecond ()
 
static Int64 TicksPerMillisecond ()
 
static Int64 TicksPerMinute ()
 
static Int64 TicksPerSecond ()
 
static bool TryParse (String const &value, TimeSpan &result)
 
static const TimeSpan Zero ()
 

Usage Description

TimeSpan Add ( TimeSpan const &  other) const

Returns an instance that is the result of adding the specified instance to the current instance.

struct timespec AsTimespec ( ) const

Gets the current TimeSpan as a timespec.

struct timeval AsTimeval ( ) const

Gets the current TimeSpan as a timeval.

int Compare ( TimeSpan const &  other) const

Compares the current instance to the specified instance.

int Days ( ) const

Returns the days component of the current instance.

TimeSpan Duration ( ) const

Returns an instance that is the absolute value of the current instance.

double FractionalSeconds ( ) const

Gets the fractional seconds component of the current instance.

static TimeSpan FromDays ( double  value)
static

Returns an instance that represents the specified number of days, to at least millisecond precision.

static TimeSpan FromHours ( double  value)
static

Returns an instance that represents the specified number of hours, to at least millisecond precision.

static TimeSpan FromMicroseconds ( Int64  value)
static

Returns an instance that represents the specified number of microseconds.

static TimeSpan FromMilliseconds ( double  value)
static

Returns an instance that represents the specified number of milliseconds, to at least millisecond precision.

static TimeSpan FromMinutes ( double  value)
static

Returns an instance that represents the specified number of minutes, to at least millisecond precision.

static TimeSpan FromSeconds ( double  value)
static

Returns an instance that represents the specified number of seconds, to at least millisecond precision.

static TimeSpan FromTicks ( Int64  value)
static

Returns an instance that represents the specified number of ticks, where 1 tick == 100-nanoseconds.

static TimeSpan FromTimespec ( const struct timespec &  value)
static

Returns an instance that represents the specified time value.

static TimeSpan FromTimeval ( const struct timeval &  value)
static

Returns an instance that represents the specified time value.

int Hours ( ) const

Returns the hours component of the current instance in [-23, 23].

static const TimeSpan MaxValue ( )
inlinestatic

Returns an instance that represents the maximum TimeSpan value.

int Microseconds ( ) const

Returns the microseconds component of the current instance in [-999999, 999999].

int Milliseconds ( ) const

Returns the milliseconds component of the current instance in [-999, 999].

int Minutes ( ) const

Returns the minutes component of the current instance in [-59, 59].

static const TimeSpan MinValue ( )
inlinestatic

Returns an instance that represents the minimum TimeSpan value.

static int NanosecondsPerTick ( )
inlinestatic

Returns the number of nanoseconds in a tick.

TimeSpan Negate ( ) const

Returns an instance that is the negated value of the current instance.

bool operator!= ( TimeSpan const &  other) const
inline

Checks if the current instance is equal or not to the specified other instance. Returns true if they are not equal, otherwise returns false.

TimeSpan operator+ ( ) const
inline

Arithmetic operator.

TimeSpan operator+ ( TimeSpan const &  other) const
inline

Arithmetic operator.

TimeSpan& operator+= ( TimeSpan const &  other)
inline

Arithmetic operator.

TimeSpan operator- ( ) const
inline

Arithmetic operator.

TimeSpan operator- ( TimeSpan const &  other) const
inline

Arithmetic operator.

TimeSpan& operator-= ( TimeSpan const &  other)
inline

Arithmetic operator.

bool operator< ( TimeSpan const &  other) const
inline

Checks if the current instance is less than the specified other instance. Returns true if it is, otherwise returns false.

bool operator<= ( TimeSpan const &  other) const
inline

Checks if the current instance is less than or equal to the specified other instance. Returns true if it is, otherwise returns false.

TimeSpan& operator= ( TimeSpan const &  other)
bool operator== ( TimeSpan const &  other) const
inline

Checks if the current instance is equal to the specified other instance. Returns true if they are equal, otherwise returns false.

bool operator> ( TimeSpan const &  other) const
inline

Checks if the current instance is greater than the specified other instance. Returns true if it is, otherwise returns false.

bool operator>= ( TimeSpan const &  other) const
inline

Checks if the current instance is greater than or equal to the specified other instance. Returns true if it is, otherwise returns false.

int Seconds ( ) const

Returns the seconds component of the current instance in [-59, 59].

TimeSpan Subtract ( TimeSpan const &  other) const

Returns an instance that is the result of subtracting the specified instance from the current instance.

Int64 Ticks ( ) const

Returns number of ticks represented by this instance.

static Int64 TicksPerDay ( )
inlinestatic

Returns the number of ticks in a day.

static Int64 TicksPerHour ( )
inlinestatic

Returns the number of ticks in an hour.

static Int64 TicksPerMicrosecond ( )
inlinestatic

Returns the number of ticks in a microsecond.

static Int64 TicksPerMillisecond ( )
inlinestatic

Returns the number of ticks in a millisecond.

static Int64 TicksPerMinute ( )
inlinestatic

Returns the number of ticks in a minute.

static Int64 TicksPerSecond ( )
inlinestatic

Returns the number of ticks in a second.

String ToString ( ) const

Gets the current instance as a string. Format is [-][d[.]][hh:mm[:ss[.fffffff]]].

double TotalDays ( ) const

Gets the whole and fractional days represented by this instance.

double TotalHours ( ) const

Gets the whole and fractional hours represented by this instance.

double TotalMilliseconds ( ) const

Gets the whole and fractional milliseconds represented by this instance.

double TotalMinutes ( ) const

Gets the whole and fractional minutes represented by this instance.

double TotalSeconds ( ) const

Gets the whole and fractional seconds represented by this instance.

static bool TryParse ( String const &  value,
TimeSpan result 
)
static

Attempts to parse the specified string as a TimeSpan.

static const TimeSpan Zero ( )
inlinestatic

Returns an instance that represents a zero TimeSpan value.