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

`#include <hueplusplus/TimePattern.h>`

Inheritance diagram for hueplusplus::time::AbsoluteVariedTime:
[legend]
Collaboration diagram for hueplusplus::time::AbsoluteVariedTime:
[legend]

## Public Member Functions

| AbsoluteVariedTime (clock::time_point baseTime, clock::duration variation=std::chrono::seconds(0))
| Create absolute time point.
clock::duration | getRandomVariation () const
| Get random variation or zero.
std::string | toString () const
| Get formatted string as expected by Hue API.
Public Member Functions inherited from hueplusplus::time::AbsoluteTime
| AbsoluteTime (clock::time_point baseTime)
| Create absolute time point.
clock::time_point | getBaseTime () const
| Get base time point.
std::string | toString () const
| Get formatted string as expected by Hue API.

## Static Public Member Functions

static AbsoluteVariedTime | parse (const std::string &s)
| Parse AbsoluteTime from formatted string in local timezone.
Static Public Member Functions inherited from hueplusplus::time::AbsoluteTime
static AbsoluteTime | parse (const std::string &s)
| Parse AbsoluteTime from formatted string in local timezone.
static AbsoluteTime | parseUTC (const std::string &s)
| Parse AbsoluteTime from formatted UTC string.

## Detailed Description

One-time, absolute time point with possible random variation

Can be either used to represent a specific date and time, or a date and time with a random variation.

## Constructor & Destructor Documentation

## AbsoluteVariedTime()

hueplusplus::time::AbsoluteVariedTime::AbsoluteVariedTime | ( | clock::time_point | baseTime,
|  | clock::duration | variation = std::chrono::seconds(0) )

explicit

Create absolute time point.

Parameters

  baseTime | Absolute time point
  variation | Random variation, optional. When not zero, the time is randomly chosen between `baseTime - variation` and `baseTime + variation`

## Member Function Documentation

## getRandomVariation()

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

Get random variation or zero.

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

## parse()

AbsoluteVariedTime hueplusplus::time::AbsoluteVariedTime::parse | ( | const std::string & | s | ) |

static

Parse AbsoluteTime from formatted string in local timezone.

Parameters

  s | Timestamp in the same format as returned by toString()

Returns
  AbsoluteVariedTime with base time and variation from `s`

## toString()

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

Get formatted string as expected by Hue API.

Returns
  when variation is 0: Timestamp in the format `YYYY-MM-DD` T `hh:mm:ss`
  when there is variation: Timestamp in the format `YYYY-MM-DD` T `hh:mm:ss` A `hh:mm:ss` with base time first, variation second

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

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