hueplusplus  1.0.0
Classes | Functions
hueplusplus::time Namespace Reference

Namespace for time/date related classes and functions. More...

Classes

class  AbsoluteTime
 One-time, absolute time point. More...
 
class  AbsoluteVariedTime
 
class  RecurringTime
 Time repeated weekly to daily, with possible random variation. More...
 
class  TimeInterval
 Time interval repeated daily to weekly. More...
 
class  TimePattern
 Holds different time representations. More...
 
class  Timer
 Timer that is started and triggers after specified delay. More...
 
class  Weekdays
 Any number of days of the week. More...
 

Functions

std::string timepointToTimestamp (std::chrono::system_clock::time_point time)
 Converts a time_point to a timestamp string. More...
 
std::chrono::system_clock::time_point parseTimestamp (const std::string &timestamp)
 Converts a timestamp to a time_point. More...
 
std::chrono::system_clock::time_point parseUTCTimestamp (const std::string &timestamp)
 Converts an UTC timestamp to a time_point. More...
 
std::string durationTo_hh_mm_ss (std::chrono::system_clock::duration duration)
 Converts duration to a time string. More...
 
std::chrono::system_clock::duration parseDuration (const std::string &hourMinSec)
 Converts time string to a duration. More...
 

Detailed Description

Namespace for time/date related classes and functions.

Function Documentation

◆ durationTo_hh_mm_ss()

std::string hueplusplus::time::durationTo_hh_mm_ss ( std::chrono::system_clock::duration  duration)

Converts duration to a time string.

Parameters
durationDuration or time of day to format. Must be less than 24 hours
Returns
Duration string in the format hh:mm:ss
Exceptions
HueExceptionwhen duration longer than 24 hours.

◆ parseDuration()

system_clock::duration hueplusplus::time::parseDuration ( const std::string &  hourMinSec)

Converts time string to a duration.

Parameters
hourMinSecTime/duration in the format hh:mm:ss
Returns
Duration (hours, minutes and seconds) from the string
Exceptions
std::invalid_argumentwhen integer conversion fails

◆ parseTimestamp()

system_clock::time_point hueplusplus::time::parseTimestamp ( const std::string &  timestamp)

Converts a timestamp to a time_point.

Parameters
timestampTimestamp from the local time zone in the format YYYY-MM-DDThh:mm:ss
Returns
time_point of the local system clock
Exceptions
std::invalid_argumentwhen integer conversion fails
HueExceptionwhen time cannot be represented as time_point

◆ parseUTCTimestamp()

std::chrono::system_clock::time_point hueplusplus::time::parseUTCTimestamp ( const std::string &  timestamp)

Converts an UTC timestamp to a time_point.

Parameters
timestampUTC Timestamp the format YYYY-MM-DDThh:mm:ss
Returns
time_point of the local system clock
Exceptions
std::invalid_argumentwhen integer conversion fails
HueExceptionwhen time cannot be represented as time_point

◆ timepointToTimestamp()

std::string hueplusplus::time::timepointToTimestamp ( std::chrono::system_clock::time_point  time)

Converts a time_point to a timestamp string.

Parameters
timeTime to convert
Returns
Date and time in the format YYYY-MM-DDThh:mm:ss.

Returns the time in the local time zone.

Exceptions
HueExceptionwhen time could not be converted