Loading...
Searching...
No Matches
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 | Weekdays
| Any number of days of the week. More...
class | RecurringTime
| Time repeated weekly to daily, with possible random variation. More...
class | TimeInterval
| Time interval repeated daily to weekly. More...
class | Timer
| Timer that is started and triggers after specified delay. More...
class | TimePattern
| Holds different time representations. More...

## Functions

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

## 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

  duration | Duration or time of day to format. Must be less than 24 hours

Returns
  Duration string in the format `hh:mm:ss`

Exceptions

  HueException | when `duration` longer than 24 hours.

## parseDuration()

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

Converts time string to a duration.

Parameters

  hourMinSec | Time/duration in the format `hh:mm:ss`

Returns
  Duration (hours, minutes and seconds) from the string

Exceptions

  std::invalid_argument | when integer conversion fails

## parseTimestamp()

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

Converts a timestamp to a time_point.

Parameters

  timestamp | Timestamp from the local time zone in the format `YYYY-MM-DD` T `hh:mm:ss`

Returns
  time_point of the local system clock

Exceptions

  std::invalid_argument | when integer conversion fails
  HueException | when 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

  timestamp | UTC Timestamp the format `YYYY-MM-DD` T `hh:mm:ss`

Returns
  time_point of the local system clock

Exceptions

  std::invalid_argument | when integer conversion fails
  HueException | when 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

  time | Time to convert

Returns
  Date and time in the format `YYYY-MM-DD` T `hh:mm:ss`.

Returns the time in the local time zone.

Exceptions

  HueException | when time could not be converted