ARC SDK
Public Member Functions | Static Public Member Functions | Static Public Attributes
Arc::Time Class Reference

A class for storing and manipulating times. More...

#include <arc/DateTime.h>

Public Member Functions

 Time ()
 Default constructor. The time is put equal the current time. More...
 
 Time (time_t)
 Constructor that takes a time_t variable and stores it. More...
 
 Time (time_t time, uint32_t nanosec)
 Constructor that takes a fine grained time variables and stores them. More...
 
 Time (const std::string &)
 Constructor that tries to convert a string into a time_t. More...
 
Timeoperator= (time_t)
 Assignment operator from a time_t. More...
 
Timeoperator= (const Time &)
 Assignment operator from a Time. More...
 
Timeoperator= (const char *)
 Assignment operator from a char pointer. More...
 
Timeoperator= (const std::string &)
 Assignment operator from a string. More...
 
void SetTime (time_t)
 Sets the time. More...
 
void SetTime (time_t time, uint32_t nanosec)
 Sets the fine grained time. More...
 
time_t GetTime () const
 Gets the time in seconds. More...
 
uint32_t GetTimeNanoseconds () const
 Gets the nanoseconds fraction of the time. More...
 
 operator std::string () const
 Returns a string representation of the time, using the default format. More...
 
std::string str (const TimeFormat &=time_format) const
 Returns a string representation of the time, using the specified format. More...
 
bool operator< (const Time &) const
 Comparing two Time objects. More...
 
bool operator> (const Time &) const
 Comparing two Time objects. More...
 
bool operator<= (const Time &) const
 Comparing two Time objects. More...
 
bool operator>= (const Time &) const
 Comparing two Time objects. More...
 
bool operator== (const Time &) const
 Comparing two Time objects. More...
 
bool operator!= (const Time &) const
 Comparing two Time objects. More...
 
Time operator+ (const Period &) const
 Adding Time object with Period object. More...
 
Time operator- (const Period &) const
 Subtracting Period object from Time object. More...
 
Period operator- (const Time &) const
 Subtracting Time object from the other Time object. More...
 

Static Public Member Functions

static void SetFormat (const TimeFormat &)
 Sets the default format for time strings. More...
 
static TimeFormat GetFormat ()
 Gets the default format for time strings. More...
 

Static Public Attributes

static const int YEAR = 31536000
 Number of seconds in a year (365 days) More...
 
static const int MONTH = 2592000
 Number of seconds in 30 days. More...
 
static const int WEEK = 604800
 Number of seconds in a week. More...
 
static const int DAY = 86400
 Number of seconds in a day. More...
 
static const int HOUR = 3600
 Number of seconds in an hour. More...
 
static const time_t UNDEFINED = (time_t)(-1)
 Undefined time. More...
 

Detailed Description

A class for storing and manipulating times.

Time represents a moment of time (eg midnight on 1st Jan 2000), whereas Period represents a length of time (eg 2 mins and 30.1 seconds).

See also
Period

Constructor & Destructor Documentation

◆ Time() [1/4]

Arc::Time::Time ( )

Default constructor. The time is put equal the current time.

◆ Time() [2/4]

Arc::Time::Time ( time_t  )

Constructor that takes a time_t variable and stores it.

◆ Time() [3/4]

Arc::Time::Time ( time_t  time,
uint32_t  nanosec 
)

Constructor that takes a fine grained time variables and stores them.

◆ Time() [4/4]

Arc::Time::Time ( const std::string &  )

Constructor that tries to convert a string into a time_t.

Member Function Documentation

◆ GetFormat()

static TimeFormat Arc::Time::GetFormat ( )
static

Gets the default format for time strings.

◆ GetTime()

time_t Arc::Time::GetTime ( ) const

Gets the time in seconds.

◆ GetTimeNanoseconds()

uint32_t Arc::Time::GetTimeNanoseconds ( ) const

Gets the nanoseconds fraction of the time.

◆ operator std::string()

Arc::Time::operator std::string ( ) const

Returns a string representation of the time, using the default format.

◆ operator!=()

bool Arc::Time::operator!= ( const Time ) const

Comparing two Time objects.

◆ operator+()

Time Arc::Time::operator+ ( const Period ) const

Adding Time object with Period object.

◆ operator-() [1/2]

Time Arc::Time::operator- ( const Period ) const

Subtracting Period object from Time object.

◆ operator-() [2/2]

Period Arc::Time::operator- ( const Time ) const

Subtracting Time object from the other Time object.

◆ operator<()

bool Arc::Time::operator< ( const Time ) const

Comparing two Time objects.

◆ operator<=()

bool Arc::Time::operator<= ( const Time ) const

Comparing two Time objects.

◆ operator=() [1/4]

Time& Arc::Time::operator= ( time_t  )

Assignment operator from a time_t.

Python interface deviation
Method is unavailable in Python interface

◆ operator=() [2/4]

Time& Arc::Time::operator= ( const Time )

Assignment operator from a Time.

Python interface deviation
Method is unavailable in Python interface

◆ operator=() [3/4]

Time& Arc::Time::operator= ( const char *  )

Assignment operator from a char pointer.

Python interface deviation
Method is unavailable in Python interface

◆ operator=() [4/4]

Time& Arc::Time::operator= ( const std::string &  )

Assignment operator from a string.

Python interface deviation
Method is unavailable in Python interface

◆ operator==()

bool Arc::Time::operator== ( const Time ) const

Comparing two Time objects.

◆ operator>()

bool Arc::Time::operator> ( const Time ) const

Comparing two Time objects.

◆ operator>=()

bool Arc::Time::operator>= ( const Time ) const

Comparing two Time objects.

◆ SetFormat()

static void Arc::Time::SetFormat ( const TimeFormat )
static

Sets the default format for time strings.

◆ SetTime() [1/2]

void Arc::Time::SetTime ( time_t  )

Sets the time.

◆ SetTime() [2/2]

void Arc::Time::SetTime ( time_t  time,
uint32_t  nanosec 
)

Sets the fine grained time.

◆ str()

std::string Arc::Time::str ( const TimeFormat = time_format) const

Returns a string representation of the time, using the specified format.

Field Documentation

◆ DAY

const int Arc::Time::DAY = 86400
static

Number of seconds in a day.

◆ HOUR

const int Arc::Time::HOUR = 3600
static

Number of seconds in an hour.

◆ MONTH

const int Arc::Time::MONTH = 2592000
static

Number of seconds in 30 days.

◆ UNDEFINED

const time_t Arc::Time::UNDEFINED = (time_t)(-1)
static

Undefined time.

◆ WEEK

const int Arc::Time::WEEK = 604800
static

Number of seconds in a week.

◆ YEAR

const int Arc::Time::YEAR = 31536000
static

Number of seconds in a year (365 days)


The documentation for this class was generated from the following file: