This class contains date and time informations.
More...
#include <DateTime.hpp>
|
|
| DateTime (void) |
| | Default constructor.
|
| |
| | DateTime (int64 ticks, DateTimeKind kind) |
| | Constructs an DateTime instance. More...
|
| |
| | DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, DateTimeKind kind) |
| | Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second and millisecond. More...
|
| |
| Ticks | GetTicks (void) const |
| | Gets the ticks of this instance in units of 100 nanoseconds. More...
|
| |
| DateTimeKind | GetKind (void) const |
| | Gets the DateTimeKind of this instance. More...
|
| |
| int | GetYear (void) const |
| | Gets the year of this instance. More...
|
| |
| int | GetMonth (void) const |
| | Gets the month of this instance. More...
|
| |
| int | GetDay (void) const |
| | Gets the day of this instance. More...
|
| |
| int | GetHour (void) const |
| | Gets the hour of this instance. More...
|
| |
| int | GetMinute (void) const |
| | Gets the minute of this instance. More...
|
| |
| int | GetSecond (void) const |
| | Gets the second of this instance. More...
|
| |
| int | GetMillisecond (void) const |
| | Gets the millisecond of this instance. More...
|
| |
| int | GetMicrosecond (void) const |
| | Gets the microsecond of this instance. More...
|
| |
| bool | IsEmpty (void) const |
| | Checks if this instance represents a valid date. More...
|
| |
| time_t | ToUnixTime (void) const |
| | Converts this instance to unix time (UTC). More...
|
| |
| int64 | ToUnixTimeMicroseconds (void) const |
| | Converts this instance to unix time in microseconds (UTC). More...
|
| |
| Value | ToBinary (void) const |
| | Converts this instance to its binary representation. More...
|
| |
| int64 | ToOpcUaTime (void) const |
| | Converts this instance to OpcUA time (UTC). More...
|
| |
| String | ToIso8601String (void) const |
| | Converts this instance to an Iso8601 string . More...
|
| |
|
| static const int64 | MinTicks = 0 |
| | DEPRECATED. More...
|
| |
| static const int64 | MaxTicks = ((((365LL * 4LL + 1LL) * 25LL - 1LL) * 4LL + 1LL) * 25LL - 366LL) * (10LL * 1000LL * 1000LL * 60LL * 60LL * 24LL) - 1LL |
| | DEPRECATED. More...
|
| |
This class contains date and time informations.
The granularity of the time values is 100 nanoseconds units called ticks. The origin of the dates is 01.01.0001 at 00:00:00. Thus a particular date and time value is the number of ticks from 01.01.0001 at 00:00:00 o'clock. The implementation and internal representation complies to the .NET DateTime class, see https://docs.microsoft.com/de-de/dotnet/api/system.datetime?view=netframework-4.7.2.
◆ DateTime() [1/2]
| Arp::DateTime::DateTime |
( |
int64 |
ticks, |
|
|
DateTimeKind |
kind |
|
) |
| |
Constructs an DateTime instance.
- Parameters
-
| ticks | The ticks to initialize the DateTime with. |
| kind | The DateTimeKind to initialize the DateTime with. |
◆ DateTime() [2/2]
| Arp::DateTime::DateTime |
( |
int |
year, |
|
|
int |
month, |
|
|
int |
day, |
|
|
int |
hour, |
|
|
int |
minute, |
|
|
int |
second, |
|
|
int |
millisecond, |
|
|
int |
microsecond, |
|
|
DateTimeKind |
kind |
|
) |
| |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second and millisecond.
- Parameters
-
| year | The year (1 through 9999). |
| month | The month (1 through 12). |
| day | The day (1 through the number of days in month). |
| hour | The hours (0 through 23). |
| minute | The minutes (0 through 59). |
| second | The seconds (0 through 59). |
| millisecond | The milliseconds (0 through 999). |
| microsecond | The milliseconds (0 through 999). |
| kind | The DateTimeKind to initialize the DateTime with. |
◆ FromBinary()
| DateTime Arp::DateTime::FromBinary |
( |
Value |
value | ) |
|
|
static |
Creates a DateTime from the as argument passed (internal) binary representation.
- Parameters
-
| value | The binary representation to convert to DateTime. |
- Returns
- The a new DateTime representing the given binary representation.
◆ FromIso8601String()
Creates a DateTime from the as argument passed ISO8601 string.
- Parameters
-
| input | The ISO8601 time string to convert to DateTime. |
- Returns
- The a new DateTime representing the given string.
◆ FromOpcUaTime()
Creates a DateTime from the argument passed in OpcUA time.
- Parameters
-
| opcUaTime | The OpcUA time in 100ns ticks since 01.01.1601. |
- Returns
- A new DateTime representing the given OpcUA time.
◆ FromUnixTime()
| DateTime Arp::DateTime::FromUnixTime |
( |
time_t |
unixTime | ) |
|
|
static |
Creates a DateTime from the as argument passed unix time.
- Parameters
-
| unixTime | The unix time to convert to DateTime. |
- Returns
- The a new DateTime representing the given unix time.
◆ FromUnixTimeMicroseconds()
| DateTime Arp::DateTime::FromUnixTimeMicroseconds |
( |
int64 |
microseconds | ) |
|
|
static |
Creates a DateTime from the as argument passed unix time in microseconds.
- Parameters
-
| microseconds | The unix time in microseconds to convert to DateTime. |
- Returns
- A new DateTime representing the given unix time.
◆ GetDay()
| int Arp::DateTime::GetDay |
( |
void |
| ) |
const |
Gets the day of this instance.
- Returns
- The day of this date.
◆ GetHour()
| int Arp::DateTime::GetHour |
( |
void |
| ) |
const |
Gets the hour of this instance.
- Returns
- The hour of this time.
◆ GetKind()
| DateTimeKind Arp::Base::Core::DateTime::GetKind |
( |
void |
| ) |
const |
Gets the DateTimeKind of this instance.
- Returns
- The kind of this instance.
◆ GetLocalNow()
| DateTime Arp::Base::Core::DateTime::GetLocalNow |
( |
void |
| ) |
|
|
static |
Gets the current time in local time.
- Returns
- The current local time.
This operation is not implemented yet and throws an exception.
◆ GetMaxTicks()
| int64 Arp::Base::Core::DateTime::GetMaxTicks |
( |
void |
| ) |
|
|
static |
Gets the maximum number of ticks.
- Returns
- The maximal number of ticks.
◆ GetMicrosecond()
| int Arp::DateTime::GetMicrosecond |
( |
void |
| ) |
const |
Gets the microsecond of this instance.
- Returns
- The microsecond of this time.
◆ GetMillisecond()
| int Arp::DateTime::GetMillisecond |
( |
void |
| ) |
const |
Gets the millisecond of this instance.
- Returns
- The millisecond of this time.
◆ GetMinTicks()
| int64 Arp::Base::Core::DateTime::GetMinTicks |
( |
void |
| ) |
|
|
static |
Gets the minimum number of ticks.
- Returns
- The minimal number of ticks.
◆ GetMinute()
| int Arp::DateTime::GetMinute |
( |
void |
| ) |
const |
Gets the minute of this instance.
- Returns
- The minute of this time.
◆ GetMonth()
| int Arp::DateTime::GetMonth |
( |
void |
| ) |
const |
Gets the month of this instance.
- Returns
- The month of this date.
◆ GetSecond()
| int Arp::DateTime::GetSecond |
( |
void |
| ) |
const |
Gets the second of this instance.
- Returns
- The second of this time.
◆ GetTicks()
| DateTime::Ticks Arp::Base::Core::DateTime::GetTicks |
( |
void |
| ) |
const |
Gets the ticks of this instance in units of 100 nanoseconds.
- Returns
- The internal ticks of this instance.
◆ GetUtcMax()
| DateTime Arp::Base::Core::DateTime::GetUtcMax |
( |
void |
| ) |
|
|
static |
◆ GetUtcMin()
| DateTime Arp::Base::Core::DateTime::GetUtcMin |
( |
void |
| ) |
|
|
static |
◆ GetUtcNow()
| DateTime Arp::DateTime::GetUtcNow |
( |
void |
| ) |
|
|
static |
Gets the current time in UTC.
- Returns
- The current UTC time.
◆ GetYear()
| int Arp::DateTime::GetYear |
( |
void |
| ) |
const |
Gets the year of this instance.
- Returns
- The year of this date.
◆ IsEmpty()
| bool Arp::DateTime::IsEmpty |
( |
void |
| ) |
const |
Checks if this instance represents a valid date.
- Returns
- true if the objects empty
Only default-constructed objects are empty.
◆ IsLeapYear()
| bool Arp::DateTime::IsLeapYear |
( |
int |
year | ) |
|
|
static |
Returns an indication whether the specified year is a leap year.
- Parameters
-
- Returns
true if year is a leap year, otherwise false.
◆ ToBinary()
| uint64 Arp::DateTime::ToBinary |
( |
void |
| ) |
const |
Converts this instance to its binary representation.
- Returns
- The binary representation of this instance.
◆ ToIso8601String()
| DateTime::String Arp::DateTime::ToIso8601String |
( |
void |
| ) |
const |
Converts this instance to an Iso8601 string .
- Returns
- The Iso8601 string representing this instance.
◆ ToOpcUaTime()
| int64 Arp::DateTime::ToOpcUaTime |
( |
void |
| ) |
const |
Converts this instance to OpcUA time (UTC).
- Returns
- The OpcUA time representing this instance.
◆ ToUnixTime()
| time_t Arp::DateTime::ToUnixTime |
( |
void |
| ) |
const |
Converts this instance to unix time (UTC).
- Returns
- The unix time representing this instance.
◆ ToUnixTimeMicroseconds()
| int64 Arp::DateTime::ToUnixTimeMicroseconds |
( |
void |
| ) |
const |
Converts this instance to unix time in microseconds (UTC).
- Returns
- The unix time in microseconds representing this instance.
◆ operator!=
| ARP_EXPORT friend bool operator!= |
( |
const DateTime & |
left, |
|
|
const DateTime & |
right |
|
) |
| |
|
friend |
Compares the left DateTime instance to the right one.
- Parameters
-
| left | The left operand to compare. |
| right | The left operand to compare. |
- Returns
true if the left operand is not equal to the right one, otherwise false.
◆ operator<
| ARP_EXPORT friend bool operator< |
( |
const DateTime & |
left, |
|
|
const DateTime & |
right |
|
) |
| |
|
friend |
Compares the left DateTime instance to the right one.
- Parameters
-
| left | The left operand to compare. |
| right | The left operand to compare. |
- Returns
true if the left operand is less to the right one, otherwise false.
◆ operator<<
| ARP_EXPORT friend std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const DateTime & |
value |
|
) |
| |
|
friend |
Writes the DateTime value to the given output streams in Iso8601 format.
- Parameters
-
| os | The output stream to write to. |
| value | The value to write. |
- Returns
- The output stream which was passed as argument.
◆ operator<=
| ARP_EXPORT friend bool operator<= |
( |
const DateTime & |
left, |
|
|
const DateTime & |
right |
|
) |
| |
|
friend |
Compares the left DateTime instance to the right one.
- Parameters
-
| left | The left operand to compare. |
| right | The left operand to compare. |
- Returns
true if the left operand is less or equal to the right one, otherwise false.
◆ operator==
| ARP_EXPORT friend bool operator== |
( |
const DateTime & |
left, |
|
|
const DateTime & |
right |
|
) |
| |
|
friend |
Compares the left DateTime instance to the right one.
- Parameters
-
| left | The left operand to compare. |
| right | The left operand to compare. |
- Returns
true if the left operand is equal to the right one, otherwise false.
◆ operator>
| ARP_EXPORT friend bool operator> |
( |
const DateTime & |
left, |
|
|
const DateTime & |
right |
|
) |
| |
|
friend |
Compares the left DateTime instance to the right one.
- Parameters
-
| left | The left operand to compare. |
| right | The left operand to compare. |
- Returns
true if the left operand is greater to the right one, otherwise false.
◆ operator>=
| ARP_EXPORT friend bool operator>= |
( |
const DateTime & |
left, |
|
|
const DateTime & |
right |
|
) |
| |
|
friend |
Compares the left DateTime instance to the right one.
- Parameters
-
| left | The left operand to compare. |
| right | The left operand to compare. |
- Returns
true if the left operand is greater or equal to the right one, otherwise false.
◆ operator>>
| ARP_EXPORT friend std::istream & operator>> |
( |
std::istream & |
is, |
|
|
DateTime & |
value |
|
) |
| |
|
friend |
Reads the DateTime value from the given input streams in Iso8601 format.
- Parameters
-
| is | The input stream to read from. |
| value | The value to read. |
- Returns
- The input stream which was passed as argument.
◆ MaxTicks
| const int64 Arp::Base::Core::DateTime::MaxTicks = ((((365LL * 4LL + 1LL) * 25LL - 1LL) * 4LL + 1LL) * 25LL - 366LL) * (10LL * 1000LL * 1000LL * 60LL * 60LL * 24LL) - 1LL |
|
static |
◆ MinTicks
| const int64 Arp::Base::Core::DateTime::MinTicks = 0 |
|
static |
The documentation for this class was generated from the following files:
- Arp/Base/Core/Detail/DateTime.hpp
- Arp/Base/Core/Detail/DateTime.cpp
- Arp/System/Core/DateTime.cpp