DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DotNetDupe::System::DateTimeOffset Class Reference

Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC). More...

#include <DateTimeOffset.h>

Inheritance diagram for DotNetDupe::System::DateTimeOffset:

Public Member Functions

 DateTimeOffset ()
 Initializes a new instance of DateTimeOffset to 0 ticks.
 DateTimeOffset (int64_t ticks)
 Initializes a new instance of DateTimeOffset with the specified number of ticks.
int64_t GetTicks () const
 Gets the number of ticks that represent the date and time of the current DateTimeOffset object in UTC.
bool operator!= (const DateTimeOffset &other) const
 Indicates whether two DateTimeOffset instances represent different points in time.
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 one DateTimeOffset occurs earlier than another.
bool operator<= (const DateTimeOffset &other) const
 Indicates whether one DateTimeOffset occurs earlier than or at the same time as another.
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 later than or at the same time as another.
String ToString () const
 Converts the value of the current DateTimeOffset object to its equivalent string representation.
String ToString (const String &sFormat) const
 Converts the value of the current DateTimeOffset object to its equivalent string representation using the specified format.
Public Member Functions inherited from DotNetDupe::System::Object
virtual ~Object ()=default
 Virtual destructor ensuring polymorphic cleanup.
virtual bool Equals (const Object &obj) const
 Determines whether the specified Object is equal to the current Object.
virtual int GetHashCode () const
 Serves as the default hash function.
bool operator== (const Object &obj) const
 Determines reference equality between two objects.
char * ToStringA () const
 Returns narrow-character string representation.
wchar_t * ToStringW () const
 Returns wide-character string representation.

Static Public Member Functions

static DateTimeOffset Now ()
 Gets a DateTimeOffset object that is set to the current date and time on the current computer, with the offset set to the local time's offset from UTC.
static DateTimeOffset UtcNow ()
 Gets a DateTimeOffset object whose date and time are set to the current Coordinated Universal Time (UTC).
Static Public Member Functions inherited from DotNetDupe::System::Object
static bool Equals (const Object &obj1, const Object &obj2)
 Static helper determining whether two object instances are equal.

Detailed Description

Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC).

Note
Conforms to ECMA-335 Partition IV and ISO 8601. Stores an absolute point in time as 100-nanosecond ticks since January 1, 0001 00:00:00 UTC.

Definition at line 22 of file DateTimeOffset.h.

Constructor & Destructor Documentation

◆ DateTimeOffset() [1/2]

◆ DateTimeOffset() [2/2]

DotNetDupe::System::DateTimeOffset::DateTimeOffset ( int64_t ticks)
inline

Initializes a new instance of DateTimeOffset with the specified number of ticks.

Parameters
ticksA date and time expressed in the number of 100-nanosecond units.

Definition at line 29 of file DateTimeOffset.h.

Member Function Documentation

◆ GetTicks()

int64_t DotNetDupe::System::DateTimeOffset::GetTicks ( ) const
inline

Gets the number of ticks that represent the date and time of the current DateTimeOffset object in UTC.

Returns
The number of 100-nanosecond ticks.

Definition at line 33 of file DateTimeOffset.h.

Referenced by DotNetDupe::System::TimeZone::ToLocalTime(), and DotNetDupe::System::TimeZone::ToUniversalTime().

◆ Now()

DateTimeOffset DotNetDupe::System::DateTimeOffset::Now ( )
static

Gets a DateTimeOffset object that is set to the current date and time on the current computer, with the offset set to the local time's offset from UTC.

Returns
A DateTimeOffset object whose date and time is the current local time.

Query current local time from the configured system time provider.

Definition at line 10 of file DateTimeOffset.cpp.

References DateTimeOffset(), DotNetDupe::System::TimeProvider::GetLocalNow(), and DotNetDupe::System::TimeProvider::GetSystem().

◆ operator!=()

bool DotNetDupe::System::DateTimeOffset::operator!= ( const DateTimeOffset & other) const
inline

Indicates whether two DateTimeOffset instances represent different points in time.

Definition at line 61 of file DateTimeOffset.h.

References DateTimeOffset().

◆ operator-()

TimeSpan DotNetDupe::System::DateTimeOffset::operator- ( const DateTimeOffset & other) const
inline

Subtracts a DateTimeOffset from this instance to calculate the elapsed TimeSpan.

Definition at line 53 of file DateTimeOffset.h.

References DateTimeOffset(), and DotNetDupe::System::TimeSpan::TimeSpan().

◆ operator<()

bool DotNetDupe::System::DateTimeOffset::operator< ( const DateTimeOffset & other) const
inline

Indicates whether one DateTimeOffset occurs earlier than another.

Definition at line 64 of file DateTimeOffset.h.

References DateTimeOffset().

◆ operator<=()

bool DotNetDupe::System::DateTimeOffset::operator<= ( const DateTimeOffset & other) const
inline

Indicates whether one DateTimeOffset occurs earlier than or at the same time as another.

Definition at line 67 of file DateTimeOffset.h.

References DateTimeOffset().

◆ operator==()

bool DotNetDupe::System::DateTimeOffset::operator== ( const DateTimeOffset & other) const
inline

Indicates whether two DateTimeOffset instances represent the same point in time.

Definition at line 58 of file DateTimeOffset.h.

References DateTimeOffset().

◆ operator>()

bool DotNetDupe::System::DateTimeOffset::operator> ( const DateTimeOffset & other) const
inline

Indicates whether one DateTimeOffset occurs later than another.

Definition at line 70 of file DateTimeOffset.h.

References DateTimeOffset().

◆ operator>=()

bool DotNetDupe::System::DateTimeOffset::operator>= ( const DateTimeOffset & other) const
inline

Indicates whether one DateTimeOffset occurs later than or at the same time as another.

Definition at line 73 of file DateTimeOffset.h.

References DateTimeOffset().

◆ ToString() [1/2]

String DotNetDupe::System::DateTimeOffset::ToString ( ) const

Converts the value of the current DateTimeOffset object to its equivalent string representation.

Returns
A string representation of the value of the current DateTimeOffset object.

Format using ISO 8601 extended standard pattern.

Definition at line 20 of file DateTimeOffset.cpp.

References ToString().

Referenced by ToString().

◆ ToString() [2/2]

String DotNetDupe::System::DateTimeOffset::ToString ( const String & sFormat) const

Converts the value of the current DateTimeOffset object to its equivalent string representation using the specified format.

Parameters
sFormatA format specification string.
Returns
A string representation of the current DateTimeOffset object.

Convert ticks to total seconds offset by the Unix epoch (1970-01-01).

Convert seconds to platform calendar breakdown.

Format timestamp into fixed-width buffer and return String.

Definition at line 25 of file DateTimeOffset.cpp.

References DotNetDupe::System::String::String().

◆ UtcNow()

DateTimeOffset DotNetDupe::System::DateTimeOffset::UtcNow ( )
static

Gets a DateTimeOffset object whose date and time are set to the current Coordinated Universal Time (UTC).

Returns
An object whose date and time is the current Coordinated Universal Time (UTC).

Query current UTC time from the configured system time provider.

Definition at line 15 of file DateTimeOffset.cpp.

References DateTimeOffset(), DotNetDupe::System::TimeProvider::GetSystem(), and DotNetDupe::System::TimeProvider::GetUtcNow().


The documentation for this class was generated from the following files: