CONZEPT 16 C++ API
|
Absolute point in time. More...
#include "C16/Value/Moment.hpp"
Absolute point in time.
Static Public Attributes | |
static const int | YEAR_EPOCH = 1601 |
Epoch year of moments. More... | |
static const int | YEAR_MINIMUM = 1601 |
Minimum year of a moment. More... | |
static const int | YEAR_MAXIMUM = 30000 |
Maximum year of a moment. More... | |
static const Moment | EMPTY |
Empty moment (00000-00-00, 00:00:00). More... | |
static const Moment | MINIMUM |
Minimum moment (01601-01-01, 00:00:00). More... | |
static const Moment | MAXIMUM |
Maximum moment (30000-12-31, 23:59:59.9999999). More... | |
Static Public Member Functions | |
static Moment | now () |
Gets the current moment (UTC) of the system. More... | |
static Moment | now_local () |
Gets the current moment of the local timezone of the system. More... | |
static bool | leap_year (int year) |
Gets if a year is a leap year. More... | |
static int | days_in_month (int year, int month) |
Gets the days in a month. More... | |
static bool | validate (int year, int month, int day, int hours=0, int minutes=0, int seconds=0, long int decimicroseconds=0) |
Validates a moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds. More... | |
static bool | validate (long long int serial) |
Validates a moment by means of its serial in units of decimicroseconds since the epoch. More... | |
static void | validate_throw (int year, int month, int day, int hours=0, int minutes=0, int seconds=0, long int decimicroseconds=0) |
Validates a moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds. More... | |
static void | validate_throw (long long int serial) |
Validates a moment by means of its serial in units of decimicroseconds since the epoch. More... | |
Public Member Functions | |
Moment () | |
Constructs an empty moment. More... | |
Moment (int year, int month, int day, int hours=0, int minutes=0, int seconds=0, long int decimicroseconds=0) | |
Constructs a moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds. More... | |
Moment (long long int serial) | |
Constructs a moment by means of a serial in units of decimicroseconds since the epoch. More... | |
Moment (const Date &date, const Time &time) | |
Constructs a moment by means of a date and time. More... | |
Moment (const Moment &other) | |
Constructs a moment by copying another moment. More... | |
Moment & | operator= (const Moment &other) |
Assigns the moment from another moment. More... | |
int | compare (const Moment &other) const |
Compares the moment with another moment. More... | |
bool | operator== (const Moment &other) const |
Gets if the moment is equal to another moment. More... | |
bool | operator!= (const Moment &other) const |
Gets if the moment is unequal to another moment. More... | |
bool | operator< (const Moment &other) const |
Gets if the moment is earlier than another moment. More... | |
bool | operator<= (const Moment &other) const |
Gets if the moment is equal to or earlier than another moment. More... | |
bool | operator>= (const Moment &other) const |
Gets if the moment is equal to or later than another moment. More... | |
bool | operator> (const Moment &other) const |
Gets if the moment is later than another moment. More... | |
bool | empty () const |
Gets if the moment is empty. More... | |
int | year () const |
Gets the year of the moment. More... | |
int | month () const |
Gets the month of the moment. More... | |
int | day () const |
Gets the day (of the month) of the moment. More... | |
int | day_of_year () const |
Gets the day of the year of the moment. More... | |
int | day_of_week () const |
Gets the day of the week of the moment. More... | |
int | week () const |
Gets the week (according to ISO 8601) of the moment. More... | |
int | week_year () const |
Gets the year of the week (according to ISO 8601) of the moment. More... | |
bool | leap_year () const |
Gets if the moment lies in a leap year. More... | |
int | hours () const |
Gets the hours of the moment. More... | |
int | minutes () const |
Gets the minutes of the moment since the last hour. More... | |
int | seconds () const |
Gets the seconds of the moment since the last minute. More... | |
int | centiseconds () const |
Gets the centiseconds of the moment since the last second. More... | |
int | milliseconds () const |
Gets the milliseconds of the moment since the last second. More... | |
long int | microseconds () const |
Gets the microseconds of the moment since the last second. More... | |
long int | decimicroseconds () const |
Gets the decimicroseconds of the moment since the last second. More... | |
long int | nanoseconds () const |
Gets the nanoseconds of the moment since the last second. More... | |
long long int | serial () const |
Gets the serial of the moment in units of decimicroseconds since the epoch. More... | |
void | clear () |
Empties the moment. More... | |
void | assign (int year, int month, int day, int hours=0, int minutes=0, int seconds=0, long int decimicroseconds=0) |
Assigns the moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds. More... | |
void | assign (long long int serial) |
Assigns the moment by means of its serial in units of decimicroseconds since the epoch. More... | |
void | assign (const Date &date, const Time &time) |
Assigns the moment by means of a date and time. More... | |
Date | date () const |
Gets the date of the moment. More... | |
Time | time () const |
Gets the time of the moment. More... | |
|
static |
Epoch year of moments.
|
static |
Minimum year of a moment.
|
static |
Maximum year of a moment.
|
static |
Empty moment (00000-00-00, 00:00:00).
|
static |
Minimum moment (01601-01-01, 00:00:00).
|
static |
Maximum moment (30000-12-31, 23:59:59.9999999).
C16::Value::Moment::Moment | ( | ) |
Constructs an empty moment.
C16::Value::Moment::Moment | ( | int | year, |
int | month, | ||
int | day, | ||
int | hours = 0 , |
||
int | minutes = 0 , |
||
int | seconds = 0 , |
||
long int | decimicroseconds = 0 |
||
) |
Constructs a moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds.
year | Year of the moment (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the moment (1 to 12) |
day | Day (of the month) of the moment (1 to days_in_month) |
hours | Hours of the moment (0 to 23) |
minutes | Minutes of the moment since the last hour (0 to 59) |
seconds | Seconds of the moment since the last minute (0 to 59) |
decimicroseconds | Decimicroseconds of the moment since the last second (0 to 9,999,999) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
Exception::Invalidity | Day invalid. |
Exception::Invalidity | Hours invalid. |
Exception::Invalidity | Minutes invalid. |
Exception::Invalidity | Seconds invalid. |
Exception::Invalidity | Decimicroseconds invalid. |
|
explicit |
Constructs a moment by means of a serial in units of decimicroseconds since the epoch.
Exception::Invalidity | Serial invalid. |
C16::Value::Moment::Moment | ( | const Moment & | other | ) |
Constructs a moment by copying another moment.
other | Another moment |
|
static |
Gets the current moment (UTC) of the system.
Exception::Invalidity | Year invalid. Year of current moment (UTC) of the system is an invalid year of moment (YEAR_MINIMUM to YEAR_MAXIMUM). |
|
static |
Gets the current moment of the local timezone of the system.
Exception::Invalidity | Year invalid. Year of current moment of the local timezone of the system is an invalid year of moment (YEAR_MINIMUM to YEAR_MAXIMUM). |
|
static |
Gets if a year is a leap year.
year | Year (YEAR_MINIMUM to YEAR_MAXIMUM) |
Exception::Invalidity | Year invalid. |
|
static |
Gets the days in a month.
year | Year of the month (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month (1 to 12) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
|
static |
Validates a moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds.
year | Year of the moment (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the moment (1 to 12) |
day | Day (of the month) of the moment (1 to days_in_month) |
hours | Hours of the moment (0 to 23) |
minutes | Minutes of the moment since the last hour (0 to 59) |
seconds | Seconds of the moment since the last minute (0 to 59) |
decimicroseconds | Decimicroseconds of the moment since the last second (0 to 9,999,999) |
|
static |
|
static |
Validates a moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds.
year | Year of the moment (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the moment (1 to 12) |
day | Day (of the month) of the moment (1 to days_in_month) |
hours | Hours of the moment (0 to 23) |
minutes | Minutes of the moment since the last hour (0 to 59) |
seconds | Seconds of the moment since the last minute (0 to 59) |
decimicroseconds | Decimicroseconds of the moment since the last second (0 to 9,999,999) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
Exception::Invalidity | Day invalid. |
Exception::Invalidity | Hours invalid. |
Exception::Invalidity | Minutes invalid. |
Exception::Invalidity | Seconds invalid. |
Exception::Invalidity | Decimicroseconds invalid. |
|
static |
Validates a moment by means of its serial in units of decimicroseconds since the epoch.
Exception::Invalidity | Serial invalid. |
Assigns the moment from another moment.
other | Another moment |
int C16::Value::Moment::compare | ( | const Moment & | other | ) | const |
Compares the moment with another moment.
other | Another moment |
0 | The moment is equal to the other moment. |
< 0 | The moment is earlier than the other moment. |
> 0 | The moment is later than the other moment. |
bool C16::Value::Moment::operator== | ( | const Moment & | other | ) | const |
Gets if the moment is equal to another moment.
other | Another moment |
bool C16::Value::Moment::operator!= | ( | const Moment & | other | ) | const |
Gets if the moment is unequal to another moment.
other | Another moment |
bool C16::Value::Moment::operator< | ( | const Moment & | other | ) | const |
Gets if the moment is earlier than another moment.
other | Another moment |
bool C16::Value::Moment::operator<= | ( | const Moment & | other | ) | const |
Gets if the moment is equal to or earlier than another moment.
other | Another moment |
bool C16::Value::Moment::operator>= | ( | const Moment & | other | ) | const |
Gets if the moment is equal to or later than another moment.
other | Another moment |
bool C16::Value::Moment::operator> | ( | const Moment & | other | ) | const |
Gets if the moment is later than another moment.
other | Another moment |
bool C16::Value::Moment::empty | ( | ) | const |
Gets if the moment is empty.
int C16::Value::Moment::year | ( | ) | const |
Gets the year of the moment.
0 | Moment empty. |
int C16::Value::Moment::month | ( | ) | const |
Gets the month of the moment.
0 | Moment empty. |
int C16::Value::Moment::day | ( | ) | const |
Gets the day (of the month) of the moment.
0 | Moment empty. |
int C16::Value::Moment::day_of_year | ( | ) | const |
Gets the day of the year of the moment.
0 | Moment empty. |
int C16::Value::Moment::day_of_week | ( | ) | const |
Gets the day of the week of the moment.
0 | Moment empty. |
1 | Monday |
2 | Tuesday |
3 | Wednesday |
4 | Thursday |
5 | Friday |
6 | Saturday |
7 | Sunday |
int C16::Value::Moment::week | ( | ) | const |
Gets the week (according to ISO 8601) of the moment.
0 | Moment empty. |
int C16::Value::Moment::week_year | ( | ) | const |
Gets the year of the week (according to ISO 8601) of the moment.
0 | Moment empty. |
bool C16::Value::Moment::leap_year | ( | ) | const |
Gets if the moment lies in a leap year.
false
if empty. int C16::Value::Moment::hours | ( | ) | const |
Gets the hours of the moment.
0
if empty. int C16::Value::Moment::minutes | ( | ) | const |
Gets the minutes of the moment since the last hour.
0
if empty. int C16::Value::Moment::seconds | ( | ) | const |
Gets the seconds of the moment since the last minute.
0
if empty. int C16::Value::Moment::centiseconds | ( | ) | const |
Gets the centiseconds of the moment since the last second.
0
if empty. int C16::Value::Moment::milliseconds | ( | ) | const |
Gets the milliseconds of the moment since the last second.
0
if empty. long int C16::Value::Moment::microseconds | ( | ) | const |
Gets the microseconds of the moment since the last second.
0
if empty. long int C16::Value::Moment::decimicroseconds | ( | ) | const |
Gets the decimicroseconds of the moment since the last second.
0
if empty. long int C16::Value::Moment::nanoseconds | ( | ) | const |
Gets the nanoseconds of the moment since the last second.
0
if empty. long long int C16::Value::Moment::serial | ( | ) | const |
void C16::Value::Moment::clear | ( | ) |
Empties the moment.
void C16::Value::Moment::assign | ( | int | year, |
int | month, | ||
int | day, | ||
int | hours = 0 , |
||
int | minutes = 0 , |
||
int | seconds = 0 , |
||
long int | decimicroseconds = 0 |
||
) |
Assigns the moment by means of its year, month, day (of the month), hours, minutes, seconds and decimicroseconds.
year | Year of the moment (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the moment (1 to 12) |
day | Day (of the month) of the moment (1 to days_in_month) |
hours | Hours of the moment (0 to 23) |
minutes | Minutes of the moment since the last hour (0 to 59) |
seconds | Seconds of the moment since the last minute (0 to 59) |
decimicroseconds | Decimicroseconds of the moment since the last second (0 to 9,999,999) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
Exception::Invalidity | Day invalid. |
Exception::Invalidity | Hours invalid. |
Exception::Invalidity | Minutes invalid. |
Exception::Invalidity | Seconds invalid. |
Exception::Invalidity | Decimicroseconds invalid. |
void C16::Value::Moment::assign | ( | long long int | serial | ) |
Assigns the moment by means of its serial in units of decimicroseconds since the epoch.
Exception::Invalidity | Serial invalid. |
Date C16::Value::Moment::date | ( | ) | const |
Gets the date of the moment.
Date::EMPTY | Moment empty. |
Exception::Invalidity | Year invalid. Year of moment is an invalid year of date (Date::YEAR_MINIMUM to Date::YEAR_MAXIMUM). |
Time C16::Value::Moment::time | ( | ) | const |
Gets the time of the moment.
Time::EMPTY | Moment empty. |