Loading...
Searching...
No Matches
hueplusplus::time::RecurringTime Class Reference

Time repeated weekly to daily, with possible random variation. More...

`#include <hueplusplus/TimePattern.h>`

## Public Member Functions

| RecurringTime (clock::duration daytime, Weekdays days, clock::duration variation=std::chrono::seconds(0))
| Create recurring time.
clock::duration | getDaytime () const
| Get time of day.
clock::duration | getRandomVariation () const
| Get random variation.
Weekdays | getWeekdays () const
| Get days on which the repetition will happen.
std::string | toString () const
| Get formatted string as expected by Hue API.

## Detailed Description

Time repeated weekly to daily, with possible random variation.

Can be used to represent a time on one or multiple days per week. It can also have a random variation of up to 12 hours.

## Constructor & Destructor Documentation

## RecurringTime()

hueplusplus::time::RecurringTime::RecurringTime | ( | clock::duration | daytime,
|  | Weekdays | days,
|  | clock::duration | variation = `std::chrono::seconds(0)`
| ) |  |

explicit

Create recurring time.

Parameters

  daytime | Time of day, duration from the start of the day.
  days | Days to repeat on, should not be Weekdays::none()
  variation | Random variation, optional. Must be less than 12 hours. When not zero, the time is randomly chosen between `daytime - variation` and `daytime + variation`

## Member Function Documentation

## getDaytime()

system_clock::duration hueplusplus::time::RecurringTime::getDaytime | ( |  | ) | const

Get time of day.

## getRandomVariation()

system_clock::duration hueplusplus::time::RecurringTime::getRandomVariation | ( |  | ) | const

Get random variation.

The time can vary up to this amount in both directions.

## getWeekdays()

Weekdays hueplusplus::time::RecurringTime::getWeekdays | ( |  | ) | const

Get days on which the repetition will happen.

## toString()

std::string hueplusplus::time::RecurringTime::toString | ( |  | ) | const

Get formatted string as expected by Hue API.

Returns
  with no variation: W `bbb`/T `hh:mm:ss`
  with variation: W `bbb`/T `hh:mm:ss` A `hh:mm:ss`, where daytime is first and variation is second.

The documentation for this class was generated from the following files:

- include/hueplusplus/TimePattern.h
- src/TimePattern.cpp