OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::Time Class Reference

#include <Time.hpp>

Public Types

using ImplType = boost::posix_time::time_duration
 impl type is boost::posix_time::time_duration
 

Public Member Functions

int days () const
 whole number of days
 
int hours () const
 whole number of hours remaining after days
 
int minutes () const
 whole number of minutes remaining after hours
 
bool operator!= (const Time &other) const
 non-equality operator
 
Time operator* (double mult) const
 multiplication operator
 
Time operator+ (const Time &time) const
 addition operator
 
Timeoperator+= (const Time &time)
 assignment by addition operator
 
Time operator- (const Time &time) const
 difference operator
 
Timeoperator-= (const Time &time)
 assignment by difference operator
 
Time operator/ (double div) const
 division operator
 
bool operator< (const Time &rhs) const
 less than operator
 
bool operator<= (const Time &rhs) const
 less than equals operator
 
Timeoperator= (const Time &other)
 assignment operator
 
bool operator== (const Time &other) const
 equality operator
 
bool operator> (const Time &rhs) const
 greater than operator
 
bool operator>= (const Time &rhs) const
 greater than equals operator
 
int seconds () const
 whole number of seconds remaining after minutes
 
 Time ()
 default constructor
 
 Time (const ImplType &implType)
 from impl
 
 Time (const std::string &string)
 constructor from string
 
 Time (const Time &other)
 copy constructor
 
 Time (double fracDays)
 Time from number of days, fractional values ok.
 
 Time (int days, int hours, int minutes=0, int seconds=0)
 Time from days, hours, minutes, seconds.
 
 Time (tm t_tm)
 Time from std tm structure.
 
std::string toString () const
 Convert to a string.
 
double totalDays () const
 entire time in days
 
double totalHours () const
 entire time in hours
 
double totalMinutes () const
 entire time in minutes
 
int totalSeconds () const
 entire time in seconds
 

Static Public Member Functions

static Time currentTime ()
 get current local time of day
 
static Time currentTimeUTC ()
 get the current UTC time of day
 

Detailed Description

Time is a relative unit of time, resolution to the second Time is simple wrapper around boost::posix_time::time_duration Internally totalSeconds is the primary definition of time (i.e.

it does not matter how time is divided into hours, minutes, seconds)

Member Typedef Documentation

◆ ImplType

using openstudio::Time::ImplType = boost::posix_time::time_duration

impl type is boost::posix_time::time_duration

Constructor & Destructor Documentation

◆ Time() [1/7]

openstudio::Time::Time ( )

default constructor

◆ Time() [2/7]

openstudio::Time::Time ( const ImplType & implType)

from impl

◆ Time() [3/7]

openstudio::Time::Time ( double fracDays)

Time from number of days, fractional values ok.

◆ Time() [4/7]

openstudio::Time::Time ( int days,
int hours,
int minutes = 0,
int seconds = 0 )

Time from days, hours, minutes, seconds.

◆ Time() [5/7]

openstudio::Time::Time ( tm t_tm)

Time from std tm structure.

◆ Time() [6/7]

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

constructor from string

◆ Time() [7/7]

openstudio::Time::Time ( const Time & other)

copy constructor

Member Function Documentation

◆ currentTime()

static Time openstudio::Time::currentTime ( )
static

get current local time of day

◆ currentTimeUTC()

static Time openstudio::Time::currentTimeUTC ( )
static

get the current UTC time of day

◆ days()

int openstudio::Time::days ( ) const

whole number of days

◆ hours()

int openstudio::Time::hours ( ) const

whole number of hours remaining after days

◆ minutes()

int openstudio::Time::minutes ( ) const

whole number of minutes remaining after hours

◆ operator!=()

bool openstudio::Time::operator!= ( const Time & other) const

non-equality operator

◆ operator*()

Time openstudio::Time::operator* ( double mult) const

multiplication operator

◆ operator+()

Time openstudio::Time::operator+ ( const Time & time) const

addition operator

◆ operator+=()

Time & openstudio::Time::operator+= ( const Time & time)

assignment by addition operator

◆ operator-()

Time openstudio::Time::operator- ( const Time & time) const

difference operator

◆ operator-=()

Time & openstudio::Time::operator-= ( const Time & time)

assignment by difference operator

◆ operator/()

Time openstudio::Time::operator/ ( double div) const

division operator

◆ operator<()

bool openstudio::Time::operator< ( const Time & rhs) const

less than operator

◆ operator<=()

bool openstudio::Time::operator<= ( const Time & rhs) const

less than equals operator

◆ operator=()

Time & openstudio::Time::operator= ( const Time & other)

assignment operator

◆ operator==()

bool openstudio::Time::operator== ( const Time & other) const

equality operator

◆ operator>()

bool openstudio::Time::operator> ( const Time & rhs) const

greater than operator

◆ operator>=()

bool openstudio::Time::operator>= ( const Time & rhs) const

greater than equals operator

◆ seconds()

int openstudio::Time::seconds ( ) const

whole number of seconds remaining after minutes

◆ toString()

std::string openstudio::Time::toString ( ) const

Convert to a string.

◆ totalDays()

double openstudio::Time::totalDays ( ) const

entire time in days

◆ totalHours()

double openstudio::Time::totalHours ( ) const

entire time in hours

◆ totalMinutes()

double openstudio::Time::totalMinutes ( ) const

entire time in minutes

◆ totalSeconds()

int openstudio::Time::totalSeconds ( ) const

entire time in seconds