DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DateTimeOffset.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "Common.h"
9#include "System/Object.h"
10#include "System/String.h"
11#include "System/TimeSpan.h"
12#include <cstdint>
13
14namespace DotNetDupe {
15 namespace System {
16
22 class DateTimeOffset : public Object {
23 public:
25 DateTimeOffset() : _ticks(0) {}
26
29 DateTimeOffset(int64_t ticks) : _ticks(ticks) {}
30
33 int64_t GetTicks() const { return _ticks; }
34
38
42
46
50 DOTNETDUPE_API String ToString(const String& sFormat) const;
51
53 TimeSpan operator-(const DateTimeOffset& other) const {
54 return TimeSpan(_ticks - other._ticks);
55 }
56
58 bool operator==(const DateTimeOffset& other) const { return _ticks == other._ticks; }
59
61 bool operator!=(const DateTimeOffset& other) const { return _ticks != other._ticks; }
62
64 bool operator<(const DateTimeOffset& other) const { return _ticks < other._ticks; }
65
67 bool operator<=(const DateTimeOffset& other) const { return _ticks <= other._ticks; }
68
70 bool operator>(const DateTimeOffset& other) const { return _ticks > other._ticks; }
71
73 bool operator>=(const DateTimeOffset& other) const { return _ticks >= other._ticks; }
74
75 private:
76 int64_t _ticks;
77 };
78 }
79}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Base object class for DotNetDupe mirroring .NET System.Object.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Represents a time interval.
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
bool operator==(const DateTimeOffset &other) const
Indicates whether two DateTimeOffset instances represent the same point in time.
bool operator>(const DateTimeOffset &other) const
Indicates whether one DateTimeOffset occurs later than another.
bool operator<=(const DateTimeOffset &other) const
Indicates whether one DateTimeOffset occurs earlier than or at the same time as another.
int64_t GetTicks() const
Gets the number of ticks that represent the date and time of the current DateTimeOffset object in UTC...
DateTimeOffset(int64_t ticks)
Initializes a new instance of DateTimeOffset with the specified number of ticks.
String ToString() const
Converts the value of the current DateTimeOffset object to its equivalent string representation.
static DateTimeOffset Now()
Gets a DateTimeOffset object that is set to the current date and time on the current computer,...
DateTimeOffset()
Initializes a new instance of DateTimeOffset to 0 ticks.
bool operator<(const DateTimeOffset &other) const
Indicates whether one DateTimeOffset occurs earlier than another.
bool operator>=(const DateTimeOffset &other) const
Indicates whether one DateTimeOffset occurs later than or at the same time as another.
static DateTimeOffset UtcNow()
Gets a DateTimeOffset object whose date and time are set to the current Coordinated Universal Time (U...
TimeSpan operator-(const DateTimeOffset &other) const
Subtracts a DateTimeOffset from this instance to calculate the elapsed TimeSpan.
bool operator!=(const DateTimeOffset &other) const
Indicates whether two DateTimeOffset instances represent different points in time.
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
Represents a time interval (duration of time or elapsed time) measured as a positive or negative numb...
Definition TimeSpan.h:20
TimeSpan()
Initializes a new instance of TimeSpan to zero duration.
Definition TimeSpan.h:38