hueplusplus  1.0.0
Public Member Functions | Static Public Member Functions | List of all members
hueplusplus::time::AbsoluteVariedTime Class Reference

#include <hueplusplus/TimePattern.h>

+ Inheritance diagram for hueplusplus::time::AbsoluteVariedTime:
+ Collaboration diagram for hueplusplus::time::AbsoluteVariedTime:

Public Member Functions

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

Static Public Member Functions

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

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
baseTimeAbsolute time point
variationRandom 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
sTimestamp 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-DDThh:mm:ss
when there is variation: Timestamp in the format YYYY-MM-DDThh:mm:ssAhh:mm:ss with base time first, variation second

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