7 #include "Arp/System/Core/PrimitiveTypes.hpp" 11 #ifndef ARP_INSIDE_ARP_H 12 #error Never include 'DateTime.hpp' directly, just include 'Arp.h' 132 static DateTime FromUnixTime(time_t unixTime);
136 ARP_DEPRECATED(
"Use FromUnixTimeMicroseconds instead")
141 static DateTime FromUnixTimeMicroseconds(
int64 microseconds);
164 static bool IsLeapYear(
int year);
169 int64 GetTicks(
void)
const;
177 int GetYear(
void)
const;
181 int GetMonth(
void)
const;
185 int GetDay(
void)
const;
189 int GetHour(
void)
const;
193 int GetMinute(
void)
const;
197 int GetSecond(
void)
const;
201 int GetMillisecond(
void)
const;
205 int GetMicrosecond(
void)
const;
210 time_t ToUnixTime(
void)
const;
213 ARP_DEPRECATED(
"Use ToUnixTimeMicroseconds instead")
214 uint64 ToUnixMicrosecondTicks(
void)
const;
217 int64 ToUnixTimeMicroseconds(
void)
const;
220 uint64 ToBinary(
void)
const;
223 int64 ToOpcUaTime(
void)
const;
226 String ToIso8601String(
void)
const;
233 int GetDatePart(
int part)
const;
236 static int64 DateToTicks(
int year,
int month,
int day);
237 static int64 TimeToTicks(
int hour,
int minute,
int second);
238 static int64 TimeToTicks(
int hour,
int minute,
int second,
int millisecond,
int microsecond);
248 static const int kindShift = 62;
249 static const uint64 kindMask = 3ULL << kindShift;
250 static const uint64 ticksMask = ~kindMask;
253 static const int64 ticksPerMicrosecond = 10;
254 static const int64 ticksPerMillisecond = ticksPerMicrosecond * 1000;
255 static const int64 ticksPerSecond = ticksPerMillisecond * 1000;
256 static const int64 ticksPerMinute = ticksPerSecond * 60;
257 static const int64 ticksPerHour = ticksPerMinute * 60;
258 static const int64 ticksPerDay = ticksPerHour * 24;
261 static const int daysPerYear = 365;
263 static const int daysPer4Years = daysPerYear * 4 + 1;
265 static const int daysPer100Years = daysPer4Years * 25 - 1;
267 static const int daysPer400Years = daysPer100Years * 4 + 1;
270 static const int daysTo1970 = daysPer400Years * 4 + daysPer100Years * 3 + daysPer4Years * 17 + daysPerYear;
272 static const int daysTo1601 = daysPer400Years * 4;
274 static const int daysTo10000 = daysPer400Years * 25 - 366;
276 static const int daysToMonth365[];
277 static const int daysToMonth366[];
279 static const int datePartYear = 0;
280 static const int datePartMonth = 2;
281 static const int datePartDayOfYear = 1;
282 static const int datePartDay = 3;
285 static const int64 unix0Ticks = daysTo1970 * ticksPerDay;
286 static const int64 opcua0Ticks = daysTo1601 * ticksPerDay;
294 static const int64 MaxTicks = daysTo10000 * ticksPerDay - 1;
336 return (
int64)(this->data & ticksMask);
bool operator<(const DateTime &arg) const
Compares the ticks of this instance to arg .
Definition: DateTime.hpp:319
std::istream & operator>>(std::istream &is, BasicString< CharType, Alloc > &right)
Streams the instream is into the right string.
Definition: BasicString.hxx:1595
bool operator>=(const DateTime &arg) const
Compares the ticks of this instance to arg .
Definition: DateTime.hpp:324
static DateTime FromIso8601String(const String &value)
Creates a DateTime from the as argument passed ISO8601 string.
friend std::ostream & operator<<(std::ostream &os, const DateTime &dateTime)
The ostream operator is used for logging and string formatting and formats the DateTime value in ISO-...
Definition: DateTime.hpp:350
bool operator!=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on inequality.
Definition: BasicString.hxx:1788
friend std::istream & operator>>(std::istream &is, DateTime &dateTime)
The istream operator is used for string parsing and expects the ISO-8601 format.
Definition: DateTime.hpp:357
std::ostream & operator<<(std::ostream &os, const BasicString< CharType, Alloc > &right)
Streams the right string to the outstream os .
Definition: BasicString.hxx:1584
The class contains date and time informations.
Definition: DateTime.hpp:44
bool operator>(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1860
bool operator<(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1824
bool operator==(const DateTime &arg) const
Compares the ticks of this instance to arg .
Definition: DateTime.hpp:304
static DateTime FromUnixMicrosecondTicks(uint64 microseconds)
Creates a DateTime from the as argument passed unix time in microseconds.
Definition: DateTime.hpp:344
Kind of time in not specified
DateTimeKind
Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC)...
Definition: DateTime.hpp:25
bool operator>(const DateTime &arg) const
Compares the ticks of this instance to arg .
Definition: DateTime.hpp:314
bool operator!=(const DateTime &arg) const
Compares the ticks of this instance to arg .
Definition: DateTime.hpp:309
bool operator<=(const DateTime &arg) const
Compares the ticks of this instance to arg .
Definition: DateTime.hpp:329
Root namespace for the PLCnext API
std::uint64_t uint64
The Arp unsigned integer type of 8 byte size.
Definition: PrimitiveTypes.hpp:39
bool operator==(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on equality.
Definition: BasicString.hxx:1752
int64 GetTicks(void) const
Gets the number of ticks that represent the date and time of this instance.
Definition: DateTime.hpp:334
bool operator>=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1932
DateTimeKind GetKind(void) const
Gets a value that indicates whether the time represented by this instance is based on local time...
Definition: DateTime.hpp:339
String ToIso8601String(void) const
Converts this instance to an ISO8601 string .
DateTime(void)
Constructs an zero'ed DateTime instance.
Definition: DateTime.hpp:299
std::int64_t int64
The Arp integer type of 8 byte size.
Definition: PrimitiveTypes.hpp:41
bool operator<=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1896