|
ASAP
1.0.0
A C++ header-only library for creating, displaying, iterating and manipulating dates
|
Classes | |
| class | datetime |
| The asap::datetime class exposes methods to create, manipulate and print dates. More... | |
| class | duration |
| The asap::duration class exposes methods to create, manipulate and print durations. More... | |
| class | period |
| The asap::period class is a bound period, with starting and ending dates. Its purpose is to provide datetime iteration. More... | |
Typedefs | |
| using | seconds = duration< 1 > |
| A duration specified in seconds. | |
| using | second = seconds |
| A duration specified in seconds. | |
| using | minutes = duration< SECONDS_IN_MINUTE > |
| A duration specified in minutes. | |
| using | minute = minutes |
| A duration specified in minutes. | |
| using | hours = duration< SECONDS_IN_HOUR > |
| A duration specified in hours. | |
| using | hour = hours |
| A duration specified in hours. | |
| using | days = duration< SECONDS_IN_DAY > |
| A duration specified in days. | |
| using | day = days |
| A duration specified in days. | |
| using | weeks = duration< SECONDS_IN_WEEK > |
| A duration specified in weeks (7 days) | |
| using | week = weeks |
| A duration specified in weeks (7 days) | |
| using | months = duration< SECONDS_IN_MONTH > |
| A duration specified in months (30 days) | |
| using | month = months |
| A duration specified in months (30 days) | |
| using | years = duration< SECONDS_IN_YEAR > |
| A duration specified in years. | |
| using | year = years |
| A duration specified in years. | |
Functions | |
| static asap::datetime | now () |
Creates an asap::datetime instance representing current time. More... | |
| static asap::datetime | tomorrow () |
Creates an asap::datetime instance representing the next day at 00:00:00. More... | |
| static asap::datetime | yesterday () |
Creates an asap::datetime instance representing the previous day at 00:00:00. More... | |
| template<uint64_t convert> | |
| static asap::datetime | operator+ (const asap::datetime &a, const duration< convert > &b) |
| Adds a duration to a datetime. More... | |
| template<uint64_t convert> | |
| static asap::datetime | operator- (const asap::datetime &a, const duration< convert > &b) |
| Subtracts a duration from a datetime. More... | |
| static asap::datetime | operator+ (const asap::datetime &a, std::time_t b) |
| Adds a duration specified in a time_t to a datetime. More... | |
| static asap::datetime | operator- (const asap::datetime &a, std::time_t b) |
| Subtracts a duration specified in a time_t from a datetime. More... | |
| template<uint64_t c1, uint64_t c2> | |
| static duration< c1 > | operator+ (const duration< c1 > &a, const duration< c2 > &b) |
| Adds two durations. More... | |
| template<uint64_t conv> | |
| static duration< conv > | operator+ (const duration< conv > &a, const duration< conv > &b) |
| Adds two durations of the same converting factor. More... | |
| template<uint64_t c1, uint64_t c2> | |
| static duration< c1 > | operator- (const duration< c1 > &a, const duration< c2 > &b) |
| Subtracts two durations. More... | |
| template<uint64_t c1> | |
| static duration< c1 > | operator- (const duration< c1 > &a) |
| Inverts the sign of the duration. More... | |
| static bool | operator< (const asap::datetime &a, const asap::datetime &b) |
Compares if a < b is true for two asap::datetime instances. More... | |
| static bool | operator> (const asap::datetime &a, const asap::datetime &b) |
Compares if a > b is true for two asap::datetime instances. More... | |
| static bool | operator== (const asap::datetime &a, const asap::datetime &b) |
Compares if a == b is true for two asap::datetime instances. More... | |
| template<typename ostream > | |
| static ostream & | operator<< (ostream &os, const asap::datetime &dt) |
| Inserts a datetime into an standard output stream. More... | |
| template<typename ostream , uint64_t convert> | |
| static ostream & | operator<< (ostream &os, const duration< convert > &du) |
| Inserts a duration into an standard output stream. More... | |
Variables | |
| static constexpr uint64_t | SECONDS_IN_MINUTE = 60 |
| Specifies how many seconds there is in a standard minute of 60 seconds. | |
| static constexpr uint64_t | SECONDS_IN_HOUR = SECONDS_IN_MINUTE * 60 |
| Specifies how many seconds there is in a standard hour of 60 minutes. | |
| static constexpr uint64_t | SECONDS_IN_DAY = SECONDS_IN_HOUR * 24 |
| Specifies how many seconds there is in a standard day of 24 hours. | |
| static constexpr uint64_t | SECONDS_IN_MONTH = SECONDS_IN_DAY * 30 |
| Specifies how many seconds there is in a standard month of 30 days. | |
| static constexpr uint64_t | SECONDS_IN_YEAR = SECONDS_IN_DAY * 365 |
| Specifies how many seconds there is in a standard year of 365 days. | |
| static constexpr uint64_t | SECONDS_IN_WEEK = SECONDS_IN_DAY * 7 |
| Specifies how many seconds there is in a standard week of 7 days. | |
The asap namespace contains all symbols, classes and functions for the ASAP library
|
inlinestatic |
Creates an asap::datetime instance representing current time.
asap::datetime instance
|
inlinestatic |
Adds a duration to a datetime.
| convert | the converting factor for the duration (automatically deduced) |
| a | the datetime |
| b | the duration |
Definition at line 36 of file operators.h.
|
inlinestatic |
Adds a duration specified in a time_t to a datetime.
| a | the datetime |
| b | the duration in seconds since epoch (time_t) |
Definition at line 63 of file operators.h.
|
inlinestatic |
Adds two durations.
| c1 | the converting factor for the first duration (automatically deduced) |
| c2 | the converting factor for the second duration (automatically deduced) |
| a | The first duration |
| b | The second duration |
Definition at line 90 of file operators.h.
|
inlinestatic |
Adds two durations of the same converting factor.
| conv | the converting factor for the second duration (automatically deduced) |
| a | The first duration |
| b | The second duration |
Definition at line 104 of file operators.h.
|
inlinestatic |
Subtracts a duration from a datetime.
| convert | the converting factor for the duration (automatically deduced) |
| a | the datetime |
| b | the duration |
Definition at line 50 of file operators.h.
|
inlinestatic |
Subtracts a duration specified in a time_t from a datetime.
| a | the datetime |
| b | the duration in seconds since epoch (time_t) |
Definition at line 75 of file operators.h.
|
inlinestatic |
Subtracts two durations.
| c1 | the converting factor for the first duration (automatically deduced) |
| c2 | the converting factor for the second duration (automatically deduced) |
| a | The first duration |
| b | The second duration |
Definition at line 119 of file operators.h.
Inverts the sign of the duration.
| c1 | the convert factor of the duration (automatically deduced) |
| a | The duration |
-a (e.g, 1 day -> minus 1 day) Definition at line 132 of file operators.h.
|
inlinestatic |
Compares if a < b is true for two asap::datetime instances.
| a | The first operand |
| b | The second operand |
Definition at line 144 of file operators.h.
|
inlinestatic |
Inserts a datetime into an standard output stream.
| ostream | The output stream type |
| os | The output stream instance |
| dt | The datetime to insert |
this allows you to write std::cout << asap::now() << std::endl
Definition at line 177 of file operators.h.
|
inlinestatic |
Inserts a duration into an standard output stream.
| ostream | The output stream type |
| convert | The converting factor for the duration (automatically deduced) |
| os | The output stream instance |
| du | The duration to insert |
this allows you to write std::cout << asap::now() << std::endl
Definition at line 191 of file operators.h.
|
inlinestatic |
Compares if a == b is true for two asap::datetime instances.
| a | The first operand |
| b | The second operand |
Definition at line 164 of file operators.h.
|
inlinestatic |
Compares if a > b is true for two asap::datetime instances.
| a | The first operand |
| b | The second operand |
Definition at line 154 of file operators.h.
|
inlinestatic |
Creates an asap::datetime instance representing the next day at 00:00:00.
asap::datetime instance
|
inlinestatic |
Creates an asap::datetime instance representing the previous day at 00:00:00.
asap::datetime instance
1.8.14