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

#include <DateTime.hpp>

Public Member Functions

Date date () const
 getter to date member More...
 
 DateTime ()
 default constructor More...
 
 DateTime (const Date &date)
 constructor from Date More...
 
 DateTime (const Date &date, const Time &timeFromDate)
 constructor from Date and Time More...
 
 DateTime (const DateTime &other)
 copy constructor More...
 
 DateTime (const std::string &string)
 constructor from string More...
 
 DateTime (tm t_tm)
 from system tm struct More...
 
bool operator!= (const DateTime &other) const
 non-equality operator More...
 
DateTime operator+ (const Time &time) const
 addition operator More...
 
DateTimeoperator+= (const Time &time)
 assignment by addition operator More...
 
DateTime operator- (const Time &time) const
 difference operator More...
 
Time operator- (const DateTime &dateTime) const
 time duration More...
 
Time operator- (const Date &date) const
 time duration More...
 
DateTimeoperator-= (const Time &time)
 assignment by difference operator More...
 
bool operator< (const DateTime &rhs) const
 less than operator More...
 
bool operator<= (const DateTime &rhs) const
 less than equals operator More...
 
DateTimeoperator= (const DateTime &other)
 assignment operator More...
 
bool operator== (const DateTime &other) const
 equality operator More...
 
bool operator> (const DateTime &rhs) const
 greater than operator More...
 
bool operator>= (const DateTime &rhs) const
 greater than equals operator More...
 
Time time () const
 getter to time member More...
 
time_t toEpoch () const
 convert to epoch time_t More...
 
std::string toISO8601 () const
 convert to ISO 8601 string More...
 
std::string toString () const
 convert to string More...
 

Static Public Member Functions

static DateTime fromEpoch (const std::time_t &time)
 construct from epoch time_t More...
 
static boost::optional< DateTimefromISO8601 (const std::string &str)
 construct from ISO 8601 string More...
 
static openstudio::LogChannel logChannel ()
 
static DateTime now ()
 get the local time now More...
 

Detailed Description

DateTime is an absolute unit of time, resolution to the second date is a valid Date time is normalized to 0 <= time < 24 hrs.

Constructor & Destructor Documentation

openstudio::DateTime::DateTime ( )

default constructor

openstudio::DateTime::DateTime ( const Date date)

constructor from Date

openstudio::DateTime::DateTime ( const Date date,
const Time timeFromDate 
)

constructor from Date and Time

openstudio::DateTime::DateTime ( const DateTime other)

copy constructor

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

constructor from string

openstudio::DateTime::DateTime ( tm  t_tm)

from system tm struct

Member Function Documentation

Date openstudio::DateTime::date ( ) const

getter to date member

static DateTime openstudio::DateTime::fromEpoch ( const std::time_t &  time)
static

construct from epoch time_t

static boost::optional<DateTime> openstudio::DateTime::fromISO8601 ( const std::string &  str)
static

construct from ISO 8601 string

static openstudio::LogChannel openstudio::DateTime::logChannel ( )
inlinestatic
static DateTime openstudio::DateTime::now ( )
static

get the local time now

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

non-equality operator

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

addition operator

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

assignment by addition operator

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

difference operator

Time openstudio::DateTime::operator- ( const DateTime dateTime) const

time duration

Time openstudio::DateTime::operator- ( const Date date) const

time duration

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

assignment by difference operator

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

less than operator

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

less than equals operator

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

assignment operator

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

equality operator

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

greater than operator

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

greater than equals operator

Time openstudio::DateTime::time ( ) const

getter to time member

time_t openstudio::DateTime::toEpoch ( ) const

convert to epoch time_t

std::string openstudio::DateTime::toISO8601 ( ) const

convert to ISO 8601 string

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

convert to string