hueplusplus
1.0.0
|
#include <hueplusplus/TimePattern.h>
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... | |
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.
|
explicit |
Create absolute time point.
baseTime | Absolute time point |
variation | Random variation, optional. When not zero, the time is randomly chosen between baseTime - variation and baseTime + variation |
system_clock::duration hueplusplus::time::AbsoluteVariedTime::getRandomVariation | ( | ) | const |
Get random variation or zero.
The time can vary up to this amount in both directions.
|
static |
Parse AbsoluteTime from formatted string in local timezone.
s | Timestamp in the same format as returned by toString() |
s
std::string hueplusplus::time::AbsoluteVariedTime::toString | ( | ) | const |
Get formatted string as expected by Hue API.
YYYY-MM-DD
Thh:mm:ss
YYYY-MM-DD
Thh:mm:ss
Ahh:mm:ss
with base time first, variation second