OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
openstudio::Time Class Reference

#include <Time.hpp>

Public Types

typedef
boost::posix_time::time_duration 
ImplType
 impl type is boost::posix_time::time_duration More...
 

Public Member Functions

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

Static Public Member Functions

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

Friends

std::ostream & operator<< (std::ostream &os, const Time &time)
 std::ostream operator<< More...
 
std::ostream & operator<< (std::ostream &os, const DateTime &dateTime)
 

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

typedef boost::posix_time::time_duration openstudio::Time::ImplType

impl type is boost::posix_time::time_duration

Constructor & Destructor Documentation

openstudio::Time::Time ( )

default constructor

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

from impl

openstudio::Time::Time ( double  fracDays)

Time from number of days, fractional values ok.

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

Time from days, hours, minutes, seconds.

openstudio::Time::Time ( tm  t_tm)

Time from std tm structure.

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

constructor from string

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

copy constructor

Member Function Documentation

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

get current local time of day

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

get the current UTC time of day

int openstudio::Time::days ( ) const

whole number of days

int openstudio::Time::hours ( ) const

whole number of hours remaining after days

int openstudio::Time::minutes ( ) const

whole number of minutes remaining after hours

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

non-equality operator

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

multiplication operator

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

addition operator

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

assignment by addition operator

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

difference operator

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

assignment by difference operator

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

division operator

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

less than operator

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

less than equals operator

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

assignment operator

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

equality operator

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

greater than operator

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

greater than equals operator

int openstudio::Time::seconds ( ) const

whole number of seconds remaining after minutes

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

Convert to a string.

double openstudio::Time::totalDays ( ) const

entire time in days

double openstudio::Time::totalHours ( ) const

entire time in hours

double openstudio::Time::totalMinutes ( ) const

entire time in minutes

int openstudio::Time::totalSeconds ( ) const

entire time in seconds

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Time time 
)
friend

std::ostream operator<<

std::ostream& operator<< ( std::ostream &  os,
const DateTime dateTime 
)
friend