Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
hdi::core::Time Class Reference

Allows for acquisition and manipulation of a time (of day) More...

#include <hdicoreTime.h>

Public Member Functions

 Time ()
 Constructs a Time object with a default value (midnight, 0:00)
 
 Time (const Time &t_)
 Constructs a Time object from another existing Time object.
 
 Time (const int32_t secsSinceMN_)
 Constructs a Time object with an offset from midnight in seconds.
 
 Time (const double secsSinceMN_)
 Constructs a Time object with an offset from midnight in seconds.
 
 Time (const std::string &time_)
 Constructs a Time object from a string representation of time.
 
 Time (const int16_t hour_, const int16_t min_, const int16_t sec_=0, const int32_t us_=0)
 Constructs a Time object from a given hour, minute, second, and microsecond.
 
virtual ~Time ()
 Destructs a Time object.
 
virtual Timeoperator= (const Time &rhs_)
 Overloaded assignment operator to copy values from one Time object to another.
 
virtual bool operator== (const Time &rhs_) const
 Overloaded equality operator to determine if two Time objects are equal.
 
virtual bool operator!= (const Time &rhs_) const
 Overloaded inequality operator to determine if two Time objects differ.
 
virtual bool operator< (const Time &rhs_) const
 Overloaded less-than operator to determine if one Time object is earlier in the day than the other.
 
virtual bool operator<= (const Time &rhs_) const
 Overloaded less-than-or-equal operator to determine if one Time object is earlier in the day than, or equal to, the other.
 
virtual bool operator> (const Time &rhs_) const
 Overloaded greater-than operator to determine if one Time object is later in the day than the other.
 
virtual bool operator>= (const Time &rhs_) const
 Overloaded greater-than-or-equal operator to determine if one Time object is later in the day than, or equal to, the other.
 
virtual Duration operator- (const Time &rhs_) const
 Overloaded subtraction operator to determine the duration between two Time objects.
 
virtual Time operator- (const Duration &rhs_) const
 Overloaded substraction operator to determine the resultant time before the target.
 
virtual Timeoperator-= (const Duration &rhs_)
 Overloaded subtraction-assignment operator to determine and assign the resultant time before the initial target.
 
virtual Time operator+ (const Duration &rhs_) const
 Overloaded addition operator to determine the resultant time after the target.
 
virtual Timeoperator+= (const Duration &rhs_)
 Overloaded addition-assignment operator to determine and assign the resultant time after the initial target.
 
virtual std::string format (const std::string &format_="H:i:s") const
 Formats the target Time object into a string representation.
 
virtual int16_t hour () const
 Gets the hour represented by the target.
 
virtual void setHour (const int16_t hour_)
 Sets the hour that the target should represent.
 
virtual int16_t minute () const
 Gets the minute of the hour represented by the target.
 
virtual void setMinute (const int16_t min_)
 Sets the minute of the hour represented by the target.
 
virtual int16_t second () const
 Gets the second of the minute represented by the target.
 
virtual void setSecond (const int16_t sec_)
 Sets the second of the minute represented by the target.
 
virtual int32_t microsecond () const
 Gets the microsecond of the second represented by the target.
 
virtual void setMicrosecond (const int32_t us_)
 Sets the microsecond of the second represented by the target.
 
virtual double secondsSinceMidnight () const
 Gets the number of seconds, since midnight, represented by the target.
 
virtual void setSecondsSinceMidnight (const double secsSinceMN_)
 Sets the number of seconds, since midnight, represented by the target.
 

Static Public Member Functions

static Time Current (const bool us_=false)
 Constructs a Time object from the current system time.
 

Friends

class DateTime
 

Detailed Description

Allows for acquisition and manipulation of a time (of day)

Constructor & Destructor Documentation

◆ Time() [1/6]

hdi::core::Time::Time ( )

Constructs a Time object with a default value (midnight, 0:00)

Author
GW
Date
11/2014

◆ Time() [2/6]

hdi::core::Time::Time ( const Time t_)

Constructs a Time object from another existing Time object.

Author
GW
Date
11/2014
Parameters
t_Existing object to copy values from

◆ Time() [3/6]

hdi::core::Time::Time ( const int32_t  secsSinceMN_)
explicit

Constructs a Time object with an offset from midnight in seconds.

Author
GW
Date
11/2014
Parameters
secsSinceMN_Number of seconds since midnight, in the range [0,86400]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ Time() [4/6]

hdi::core::Time::Time ( const double  secsSinceMN_)
explicit

Constructs a Time object with an offset from midnight in seconds.

Author
GW
Date
11/2014
Parameters
secsSinceMN_Number of seconds since midnight, in the range [0.0,86400.0]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ Time() [5/6]

hdi::core::Time::Time ( const std::string &  time_)

Constructs a Time object from a string representation of time.

Author
GW
Date
11/2014
Parameters
time_String representation of a time of day, in 24-hour format
Note
The expected format is e.g. "14:34:56.789". The hours must be in 24-hour format, and a variety of delimeters can be used (i.e. ':', '-', '.', and ','). Strings that do not follow this format have the same result as using the Time() ctor.

◆ Time() [6/6]

hdi::core::Time::Time ( const int16_t  hour_,
const int16_t  min_,
const int16_t  sec_ = 0,
const int32_t  us_ = 0 
)

Constructs a Time object from a given hour, minute, second, and microsecond.

Author
GW
Date
11/2014
Parameters
hour_Hour of the day, in the range [0,23]
min_Minute of the given hour, in the range [0,59]
sec_Second of the given minute, in the range [0,59]
us_Microsecond of the given second, in the range [0,999999]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ ~Time()

virtual hdi::core::Time::~Time ( )
virtual

Destructs a Time object.

Author
GW
Date
11/2014

Member Function Documentation

◆ Current()

static Time hdi::core::Time::Current ( const bool  us_ = false)
static

Constructs a Time object from the current system time.

Author
GW
Date
04/2015
Parameters
us_Whether to use microsecond resolution
Returns
A Time object for the current UTC time

◆ format()

virtual std::string hdi::core::Time::format ( const std::string &  format_ = "H:i:s") const
virtual

Formats the target Time object into a string representation.

Author
GW
Date
11/2014
Parameters
format_Input string representing the format for the output string
Returns
An output string for the target object's time of day, formatted as indicated
Note
The following characters are supported as part of the format_ argument: "H" for 24-hour format of an hour with leading zeros, "h" for 12-hour format of an hour with leading zeros, "G" for 24-hour format of an hour without leading zeros, "g" for 12-hour format of an hour without leading zeros, "i" for minutes with leading zeros, "s" for seconds with leading zeros, "u" for microseconds, "a" for lowercase Ante meridiem and Post meridiem, and "A" for uppercase Ante meridiem and Post meridiem.
The special characters above will be expanded as described, and any other characters will simply be inserted in the output string. A special character can be preceeded by a '\' (backslash) character to prevent expansion (the backslash will not be inserted in the output string). If a backslash character is desired in the output string, preceed it with another backslash character.

◆ hour()

virtual int16_t hdi::core::Time::hour ( ) const
virtual

Gets the hour represented by the target.

Author
GW
Date
11/2014
Returns
The hour, in 24-hour format

◆ microsecond()

virtual int32_t hdi::core::Time::microsecond ( ) const
virtual

Gets the microsecond of the second represented by the target.

Author
GW
Date
11/2014
Returns
The microsecond of the second

◆ minute()

virtual int16_t hdi::core::Time::minute ( ) const
virtual

Gets the minute of the hour represented by the target.

Author
GW
Date
11/2014
Returns
The minute of the hour

◆ operator!=()

virtual bool hdi::core::Time::operator!= ( const Time rhs_) const
virtual

Overloaded inequality operator to determine if two Time objects differ.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator; Time object to compare
Returns
true if the two objects represent different times of day

◆ operator+()

virtual Time hdi::core::Time::operator+ ( const Duration rhs_) const
virtual

Overloaded addition operator to determine the resultant time after the target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to add to the lefthand side
Returns
The time of day that would result from adding the duration to the target

◆ operator+=()

virtual Time & hdi::core::Time::operator+= ( const Duration rhs_)
virtual

Overloaded addition-assignment operator to determine and assign the resultant time after the initial target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to add to the lefthand side
Returns
The target Time object, but with its values updated to reflect the addition of the given duration

◆ operator-() [1/2]

virtual Time hdi::core::Time::operator- ( const Duration rhs_) const
virtual

Overloaded substraction operator to determine the resultant time before the target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to substract from the lefthand side
Returns
The time of day that would result from subtracting the duration from the target

◆ operator-() [2/2]

virtual Duration hdi::core::Time::operator- ( const Time rhs_) const
virtual

Overloaded subtraction operator to determine the duration between two Time objects.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Time object to "substract" from the lefthand side
Returns
The duration between the two times of day

◆ operator-=()

virtual Time & hdi::core::Time::operator-= ( const Duration rhs_)
virtual

Overloaded subtraction-assignment operator to determine and assign the resultant time before the initial target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to substract from the lefthand side
Returns
The target Time object, but with its values updated to reflect the substraction of the given duration

◆ operator<()

virtual bool hdi::core::Time::operator< ( const Time rhs_) const
virtual

Overloaded less-than operator to determine if one Time object is earlier in the day than the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Time object that might be later in the day than the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a time earlier than rhs_

◆ operator<=()

virtual bool hdi::core::Time::operator<= ( const Time rhs_) const
virtual

Overloaded less-than-or-equal operator to determine if one Time object is earlier in the day than, or equal to, the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Time object that might be later in the day than, or equal to, the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a time earlier than, or equal to, rhs_

◆ operator=()

virtual Time & hdi::core::Time::operator= ( const Time rhs_)
virtual

Overloaded assignment operator to copy values from one Time object to another.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator; Time object to copy values from
Returns
The target Time object, but with values updated to match that of rhs_

◆ operator==()

virtual bool hdi::core::Time::operator== ( const Time rhs_) const
virtual

Overloaded equality operator to determine if two Time objects are equal.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator; Time object to compare
Returns
true if the two objects represent the same time of day

◆ operator>()

virtual bool hdi::core::Time::operator> ( const Time rhs_) const
virtual

Overloaded greater-than operator to determine if one Time object is later in the day than the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Time object that might be earlier in the day than the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a time later than rhs_

◆ operator>=()

virtual bool hdi::core::Time::operator>= ( const Time rhs_) const
virtual

Overloaded greater-than-or-equal operator to determine if one Time object is later in the day than, or equal to, the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Time object that might be earlier in the day than, or equal to, the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a time later than, or equal to, rhs_

◆ second()

virtual int16_t hdi::core::Time::second ( ) const
virtual

Gets the second of the minute represented by the target.

Author
GW
Date
11/2014
Returns
The second of the minute

◆ secondsSinceMidnight()

virtual double hdi::core::Time::secondsSinceMidnight ( ) const
virtual

Gets the number of seconds, since midnight, represented by the target.

Author
GW
Date
11/2014
Returns
The number of seconds since midnight

◆ setHour()

virtual void hdi::core::Time::setHour ( const int16_t  hour_)
virtual

Sets the hour that the target should represent.

Author
GW
Date
11/2014
Parameters
hour_Hour of day, in 24-hour format, in range [0,23]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ setMicrosecond()

virtual void hdi::core::Time::setMicrosecond ( const int32_t  us_)
virtual

Sets the microsecond of the second represented by the target.

Author
GW
Date
11/2014
Parameters
us_Microsecond of the second, in range [0,999999]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ setMinute()

virtual void hdi::core::Time::setMinute ( const int16_t  min_)
virtual

Sets the minute of the hour represented by the target.

Author
GW
Date
11/2014
Parameters
min_Minute of the hour, in range [0,59]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ setSecond()

virtual void hdi::core::Time::setSecond ( const int16_t  sec_)
virtual

Sets the second of the minute represented by the target.

Author
GW
Date
11/2014
Parameters
sec_Second of the minute, in range [0,59]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.

◆ setSecondsSinceMidnight()

virtual void hdi::core::Time::setSecondsSinceMidnight ( const double  secsSinceMN_)
virtual

Sets the number of seconds, since midnight, represented by the target.

Author
GW
Date
11/2014
Parameters
secsSinceMN_Seconds since midnight, in range [0.0,86400.0]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.