nfx-datetime 0.1.1
Cross-platform C++ DateTime library with 100-nanosecond precision and ISO 8601 support
Loading...
Searching...
No Matches
nfx::time::DateTimeOffset Class Referencefinal

Timezone-aware DateTime with UTC offset. More...

#include <nfx/datetime/DateTimeOffset.h>

Public Member Functions

constexpr DateTimeOffset () noexcept
 Default constructor (minimum DateTimeOffset value with zero offset).
constexpr DateTimeOffset (const DateTime &dateTime, const TimeSpan &offset) noexcept
 Construct from DateTime and offset.
 DateTimeOffset (const DateTime &dateTime) noexcept
 Construct from DateTime (assumes local timezone offset).
constexpr DateTimeOffset (std::int64_t ticks, const TimeSpan &offset) noexcept
 Construct from tick count and offset.
 DateTimeOffset (std::int32_t year, std::int32_t month, std::int32_t day, const TimeSpan &offset) noexcept
 Construct from date components and offset.
 DateTimeOffset (std::int32_t year, std::int32_t month, std::int32_t day, std::int32_t hour, std::int32_t minute, std::int32_t second, const TimeSpan &offset) noexcept
 Construct from date and time components and offset.
 DateTimeOffset (std::int32_t year, std::int32_t month, std::int32_t day, std::int32_t hour, std::int32_t minute, std::int32_t second, std::int32_t millisecond, const TimeSpan &offset) noexcept
 Construct from date and time components with milliseconds and offset.
 DateTimeOffset (std::int32_t year, std::int32_t month, std::int32_t day, std::int32_t hour, std::int32_t minute, std::int32_t second, std::int32_t millisecond, std::int32_t microsecond, const TimeSpan &offset) noexcept
 Construct from date and time components with microseconds and offset.
 DateTimeOffset (std::string_view iso8601String)
 Parse from ISO 8601 string with timezone offset.
 DateTimeOffset (const DateTimeOffset &)=default
 Copy constructor.
 DateTimeOffset (DateTimeOffset &&) noexcept=default
 Move constructor.
 ~DateTimeOffset ()=default
 Destructor.
DateTimeOffsetoperator= (const DateTimeOffset &)=default
 Copy assignment operator.
DateTimeOffsetoperator= (DateTimeOffset &&) noexcept=default
 Move assignment operator.
constexpr std::strong_ordering operator<=> (const DateTimeOffset &other) const noexcept
 Three-way comparison operator (compares UTC values).
constexpr bool operator== (const DateTimeOffset &other) const noexcept
 Equality comparison (compares UTC values).
constexpr DateTimeOffset operator+ (const TimeSpan &duration) const noexcept
 Add time duration.
constexpr DateTimeOffset operator- (const TimeSpan &duration) const noexcept
 Subtract time duration.
constexpr TimeSpan operator- (const DateTimeOffset &other) const noexcept
 Get time difference between DateTimeOffsets (in UTC).
constexpr DateTimeOffsetoperator+= (const TimeSpan &duration) noexcept
 Add time duration (in-place).
constexpr DateTimeOffsetoperator-= (const TimeSpan &duration) noexcept
 Subtract time duration (in-place).
constexpr const DateTimedateTime () const noexcept
 Get the DateTime component (local time).
constexpr const TimeSpanoffset () const noexcept
 Get the offset from UTC.
DateTime utcDateTime () const noexcept
 Get UTC DateTime equivalent.
DateTime localDateTime () const noexcept
 Get local DateTime equivalent.
constexpr std::int64_t ticks () const noexcept
 Get tick count (100-nanosecond units of local time).
constexpr std::int64_t utcTicks () const noexcept
 Get UTC tick count.
std::int32_t year () const noexcept
 Get year component (1-9999).
std::int32_t month () const noexcept
 Get month component (1-12).
std::int32_t day () const noexcept
 Get day component (1-31).
std::int32_t hour () const noexcept
 Get hour component (0-23).
std::int32_t minute () const noexcept
 Get minute component (0-59).
std::int32_t second () const noexcept
 Get second component (0-59).
std::int32_t millisecond () const noexcept
 Get millisecond component (0-999).
std::int32_t microsecond () const noexcept
 Get microsecond component (0-999).
std::int32_t nanosecond () const noexcept
 Get nanosecond component (0-900, in hundreds).
std::int32_t dayOfWeek () const noexcept
 Get day of week (0=Sunday, 6=Saturday).
std::int32_t dayOfYear () const noexcept
 Get day of year (1-366).
std::int32_t totalOffsetMinutes () const noexcept
 Get offset in total minutes.
std::int64_t toEpochSeconds () const noexcept
 Convert to Epoch timestamp (seconds since epoch).
std::int64_t toEpochMilliseconds () const noexcept
 Convert to Epoch timestamp (milliseconds since epoch).
DateTimeOffset date () const noexcept
 Get date component (time set to 00:00:00).
TimeSpan timeOfDay () const noexcept
 Get time of day as duration since midnight.
DateTimeOffset toOffset (const TimeSpan &newOffset) const noexcept
 Convert to specified offset.
DateTimeOffset toUniversalTime () const noexcept
 Convert to UTC (offset = 00:00:00).
DateTimeOffset toLocalTime () const noexcept
 Convert to local time (system timezone).
std::int64_t toFILETIME () const noexcept
 Convert to Windows FILETIME format.
DateTimeOffset add (const TimeSpan &value) const noexcept
 Add time span.
DateTimeOffset addDays (double days) const noexcept
 Add days.
DateTimeOffset addHours (double hours) const noexcept
 Add hours.
DateTimeOffset addMilliseconds (double milliseconds) const noexcept
 Add milliseconds.
DateTimeOffset addMinutes (double minutes) const noexcept
 Add minutes.
DateTimeOffset addMonths (std::int32_t months) const noexcept
 Add months.
DateTimeOffset addSeconds (double seconds) const noexcept
 Add seconds.
DateTimeOffset addTicks (std::int64_t ticks) const noexcept
 Add ticks.
DateTimeOffset addYears (std::int32_t years) const noexcept
 Add years.
TimeSpan subtract (const DateTimeOffset &value) const noexcept
 Subtract DateTimeOffset and return TimeSpan.
DateTimeOffset subtract (const TimeSpan &value) const noexcept
 Subtract TimeSpan and return DateTimeOffset.
std::string toString () const
 Convert to ISO 8601 string with offset.
std::string toString (DateTime::Format format) const
 Convert to string using specified format.
std::string toIso8601Extended () const
 Convert to ISO 8601 extended format with full precision and offset.
bool equals (const DateTimeOffset &other) const noexcept
 Check if this DateTimeOffset equals another (same UTC time).
bool equalsExact (const DateTimeOffset &other) const noexcept
 Check if this DateTimeOffset equals another exactly (same local time and offset).
bool isValid () const noexcept
 Check if this DateTimeOffset is valid.

Static Public Member Functions

static DateTimeOffset now () noexcept
 Get current local time with system timezone offset.
static DateTimeOffset utcNow () noexcept
 Get current UTC time (offset = 00:00:00).
static DateTimeOffset today () noexcept
 Get current local date (time set to 00:00:00).
static DateTimeOffset min () noexcept
 Get minimum DateTimeOffset value.
static DateTimeOffset max () noexcept
 Get maximum DateTimeOffset value.
static DateTimeOffset epoch () noexcept
 Get Unix epoch DateTimeOffset (January 1, 1970 00:00:00 UTC).
static bool fromString (std::string_view iso8601String, DateTimeOffset &result) noexcept
 Parse ISO 8601 string with timezone offset safely without throwing exceptions.
static std::optional< DateTimeOffsetfromString (std::string_view iso8601String) noexcept
 Parse ISO 8601 string with timezone offset and return optional DateTimeOffset.
static DateTimeOffset fromEpochSeconds (std::int64_t seconds) noexcept
 Create from Epoch timestamp seconds with UTC offset.
static DateTimeOffset fromEpochMilliseconds (std::int64_t milliseconds) noexcept
 Create from Epoch timestamp milliseconds with UTC offset.
static DateTimeOffset fromFILETIME (std::int64_t FILETIME) noexcept
 Create DateTimeOffset from Windows FILETIME format.

Detailed Description

Timezone-aware DateTime with UTC offset.

Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC). Composed of a DateTime value and a TimeSpan offset that defines the difference from UTC.

Key features:

  • 100-nanosecond tick precision for maximum accuracy
  • Range: January 1, 0001 to December 31, 9999 with offset ±14:00:00
  • ISO 8601 string parsing and formatting with timezone offset
  • Cross-platform timezone-aware operations
  • Arithmetic operations that account for timezone offsets
  • Epoch timestamp support with timezone awareness

Definition at line 167 of file DateTimeOffset.h.

Constructor & Destructor Documentation

◆ DateTimeOffset() [1/8]

nfx::time::DateTimeOffset::DateTimeOffset ( const DateTime & dateTime,
const TimeSpan & offset )
inlineconstexprnoexcept

Construct from DateTime and offset.

Parameters
dateTimeThe DateTime component (local time)
offsetThe timezone offset from UTC
Here is the call graph for this function:

◆ DateTimeOffset() [2/8]

nfx::time::DateTimeOffset::DateTimeOffset ( const DateTime & dateTime)
explicitnoexcept

Construct from DateTime (assumes local timezone offset).

Parameters
dateTimeThe DateTime to use (local timezone offset will be determined automatically)
Here is the call graph for this function:

◆ DateTimeOffset() [3/8]

nfx::time::DateTimeOffset::DateTimeOffset ( std::int64_t ticks,
const TimeSpan & offset )
inlineconstexprnoexcept

Construct from tick count and offset.

Parameters
ticksNumber of 100-nanosecond intervals since January 1, 0001 (local time)
offsetThe timezone offset from UTC
Here is the call graph for this function:

◆ DateTimeOffset() [4/8]

nfx::time::DateTimeOffset::DateTimeOffset ( std::int32_t year,
std::int32_t month,
std::int32_t day,
const TimeSpan & offset )
inlinenoexcept

Construct from date components and offset.

Parameters
yearYear component (1-9999)
monthMonth component (1-12)
dayDay component (1-31)
offsetThe timezone offset from UTC
Here is the call graph for this function:

◆ DateTimeOffset() [5/8]

nfx::time::DateTimeOffset::DateTimeOffset ( std::int32_t year,
std::int32_t month,
std::int32_t day,
std::int32_t hour,
std::int32_t minute,
std::int32_t second,
const TimeSpan & offset )
inlinenoexcept

Construct from date and time components and offset.

Parameters
yearYear component (1-9999)
monthMonth component (1-12)
dayDay component (1-31)
hourHour component (0-23)
minuteMinute component (0-59)
secondSecond component (0-59)
offsetThe timezone offset from UTC
Here is the call graph for this function:

◆ DateTimeOffset() [6/8]

nfx::time::DateTimeOffset::DateTimeOffset ( std::int32_t year,
std::int32_t month,
std::int32_t day,
std::int32_t hour,
std::int32_t minute,
std::int32_t second,
std::int32_t millisecond,
const TimeSpan & offset )
inlinenoexcept

Construct from date and time components with milliseconds and offset.

Parameters
yearYear component (1-9999)
monthMonth component (1-12)
dayDay component (1-31)
hourHour component (0-23)
minuteMinute component (0-59)
secondSecond component (0-59)
millisecondMillisecond component (0-999)
offsetThe timezone offset from UTC
Here is the call graph for this function:

◆ DateTimeOffset() [7/8]

nfx::time::DateTimeOffset::DateTimeOffset ( std::int32_t year,
std::int32_t month,
std::int32_t day,
std::int32_t hour,
std::int32_t minute,
std::int32_t second,
std::int32_t millisecond,
std::int32_t microsecond,
const TimeSpan & offset )
inlinenoexcept

Construct from date and time components with microseconds and offset.

Parameters
yearYear component (1-9999)
monthMonth component (1-12)
dayDay component (1-31)
hourHour component (0-23)
minuteMinute component (0-59)
secondSecond component (0-59)
millisecondMillisecond component (0-999)
microsecondMicrosecond component (0-999)
offsetThe timezone offset from UTC
Here is the call graph for this function:

◆ DateTimeOffset() [8/8]

nfx::time::DateTimeOffset::DateTimeOffset ( std::string_view iso8601String)
inlineexplicit

Parse from ISO 8601 string with timezone offset.

Parameters
iso8601StringISO 8601 formatted string with timezone offset to parse
Here is the call graph for this function:

Member Function Documentation

◆ add()

DateTimeOffset nfx::time::DateTimeOffset::add ( const TimeSpan & value) const
inlinenodiscardnoexcept

Add time span.

Parameters
valueThe TimeSpan to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the time span
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addDays()

DateTimeOffset nfx::time::DateTimeOffset::addDays ( double days) const
nodiscardnoexcept

Add days.

Parameters
daysThe number of days to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified days
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addHours()

DateTimeOffset nfx::time::DateTimeOffset::addHours ( double hours) const
nodiscardnoexcept

Add hours.

Parameters
hoursThe number of hours to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified hours
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMilliseconds()

DateTimeOffset nfx::time::DateTimeOffset::addMilliseconds ( double milliseconds) const
nodiscardnoexcept

Add milliseconds.

Parameters
millisecondsThe number of milliseconds to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified milliseconds
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMinutes()

DateTimeOffset nfx::time::DateTimeOffset::addMinutes ( double minutes) const
nodiscardnoexcept

Add minutes.

Parameters
minutesThe number of minutes to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified minutes
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMonths()

DateTimeOffset nfx::time::DateTimeOffset::addMonths ( std::int32_t months) const
nodiscardnoexcept

Add months.

Parameters
monthsThe number of months to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified months
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSeconds()

DateTimeOffset nfx::time::DateTimeOffset::addSeconds ( double seconds) const
nodiscardnoexcept

Add seconds.

Parameters
secondsThe number of seconds to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified seconds
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTicks()

DateTimeOffset nfx::time::DateTimeOffset::addTicks ( std::int64_t ticks) const
inlinenodiscardnoexcept

Add ticks.

Parameters
ticksThe number of 100-nanosecond ticks to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified ticks
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addYears()

DateTimeOffset nfx::time::DateTimeOffset::addYears ( std::int32_t years) const
nodiscardnoexcept

Add years.

Parameters
yearsThe number of years to add to this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset plus the specified years
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ date()

DateTimeOffset nfx::time::DateTimeOffset::date ( ) const
nodiscardnoexcept

Get date component (time set to 00:00:00).

Returns
DateTimeOffset with the same date but time set to 00:00:00
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dateTime()

const DateTime & nfx::time::DateTimeOffset::dateTime ( ) const
inlinenodiscardconstexprnoexcept

Get the DateTime component (local time).

Returns
The DateTime component representing the local time
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ day()

std::int32_t nfx::time::DateTimeOffset::day ( ) const
inlinenodiscardnoexcept

Get day component (1-31).

Returns
The day component of this DateTimeOffset (1-31)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dayOfWeek()

std::int32_t nfx::time::DateTimeOffset::dayOfWeek ( ) const
inlinenodiscardnoexcept

Get day of week (0=Sunday, 6=Saturday).

Returns
The day of week as an integer (0=Sunday, 1=Monday, ..., 6=Saturday)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dayOfYear()

std::int32_t nfx::time::DateTimeOffset::dayOfYear ( ) const
inlinenodiscardnoexcept

Get day of year (1-366).

Returns
The day of year as an integer (1-366, where 366 occurs in leap years)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ epoch()

DateTimeOffset nfx::time::DateTimeOffset::epoch ( )
staticnodiscardnoexcept

Get Unix epoch DateTimeOffset (January 1, 1970 00:00:00 UTC).

Returns
DateTimeOffset representing the Unix epoch (January 1, 1970 00:00:00 UTC with zero offset)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

bool nfx::time::DateTimeOffset::equals ( const DateTimeOffset & other) const
inlinenodiscardnoexcept

Check if this DateTimeOffset equals another (same UTC time).

Parameters
otherThe DateTimeOffset to compare with
Returns
true if both DateTimeOffsets represent the same UTC time, false otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ equalsExact()

bool nfx::time::DateTimeOffset::equalsExact ( const DateTimeOffset & other) const
inlinenodiscardnoexcept

Check if this DateTimeOffset equals another exactly (same local time and offset).

Parameters
otherThe DateTimeOffset to compare with
Returns
true if both DateTimeOffsets have the same local time and offset, false otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromEpochMilliseconds()

DateTimeOffset nfx::time::DateTimeOffset::fromEpochMilliseconds ( std::int64_t milliseconds)
staticnodiscardnoexcept

Create from Epoch timestamp milliseconds with UTC offset.

Parameters
millisecondsThe number of milliseconds since Unix epoch (January 1, 1970 00:00:00 UTC)
Returns
DateTimeOffset representing the specified Epoch timestamp in UTC (offset = 00:00:00)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromEpochSeconds()

DateTimeOffset nfx::time::DateTimeOffset::fromEpochSeconds ( std::int64_t seconds)
staticnodiscardnoexcept

Create from Epoch timestamp seconds with UTC offset.

Parameters
secondsThe number of seconds since Unix epoch (January 1, 1970 00:00:00 UTC)
Returns
DateTimeOffset representing the specified Epoch timestamp in UTC (offset = 00:00:00)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromFILETIME()

DateTimeOffset nfx::time::DateTimeOffset::fromFILETIME ( std::int64_t FILETIME)
staticnodiscardnoexcept

Create DateTimeOffset from Windows FILETIME format.

Works on any platform - performs mathematical epoch conversion only. Useful for processing Windows-originated data on any system.

Parameters
FILETIME100-nanosecond intervals since January 1, 1601 UTC
Returns
DateTimeOffset representing the same instant in UTC (offset = 00:00:00)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromString() [1/2]

std::optional< DateTimeOffset > nfx::time::DateTimeOffset::fromString ( std::string_view iso8601String)
staticnodiscardnoexcept

Parse ISO 8601 string with timezone offset and return optional DateTimeOffset.

Parameters
iso8601StringThe ISO 8601 formatted string with timezone offset to parse
Returns
std::optional<DateTimeOffset> containing the parsed value if successful, std::nullopt otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:

◆ fromString() [2/2]

bool nfx::time::DateTimeOffset::fromString ( std::string_view iso8601String,
DateTimeOffset & result )
staticnodiscardnoexcept

Parse ISO 8601 string with timezone offset safely without throwing exceptions.

Parameters
iso8601StringThe ISO 8601 formatted string with timezone offset to parse
resultReference to store the parsed DateTimeOffset if successful
Returns
true if parsing succeeded, false otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hour()

std::int32_t nfx::time::DateTimeOffset::hour ( ) const
inlinenodiscardnoexcept

Get hour component (0-23).

Returns
The hour component of this DateTimeOffset (0-23)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValid()

bool nfx::time::DateTimeOffset::isValid ( ) const
nodiscardnoexcept

Check if this DateTimeOffset is valid.

Returns
true if this DateTimeOffset represents a valid date and time with valid offset, false otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ localDateTime()

DateTime nfx::time::DateTimeOffset::localDateTime ( ) const
nodiscardnoexcept

Get local DateTime equivalent.

Returns
The DateTime representing this time in local timezone
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ max()

DateTimeOffset nfx::time::DateTimeOffset::max ( )
staticnodiscardnoexcept

Get maximum DateTimeOffset value.

Returns
DateTimeOffset representing the maximum representable date (December 31, 9999 23:59:59.9999999 with zero offset)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ microsecond()

std::int32_t nfx::time::DateTimeOffset::microsecond ( ) const
inlinenodiscardnoexcept

Get microsecond component (0-999).

Returns
The microsecond component of this DateTimeOffset (0-999)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ millisecond()

std::int32_t nfx::time::DateTimeOffset::millisecond ( ) const
inlinenodiscardnoexcept

Get millisecond component (0-999).

Returns
The millisecond component of this DateTimeOffset (0-999)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ min()

DateTimeOffset nfx::time::DateTimeOffset::min ( )
staticnodiscardnoexcept

Get minimum DateTimeOffset value.

Returns
DateTimeOffset representing the minimum representable date (January 1, 0001 00:00:00.0000000 with zero offset)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ minute()

std::int32_t nfx::time::DateTimeOffset::minute ( ) const
inlinenodiscardnoexcept

Get minute component (0-59).

Returns
The minute component of this DateTimeOffset (0-59)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ month()

std::int32_t nfx::time::DateTimeOffset::month ( ) const
inlinenodiscardnoexcept

Get month component (1-12).

Returns
The month component of this DateTimeOffset (1-12)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nanosecond()

std::int32_t nfx::time::DateTimeOffset::nanosecond ( ) const
inlinenodiscardnoexcept

Get nanosecond component (0-900, in hundreds).

Returns
The nanosecond component of this DateTimeOffset in hundreds (0-900)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ now()

DateTimeOffset nfx::time::DateTimeOffset::now ( )
staticnodiscardnoexcept

Get current local time with system timezone offset.

Returns
DateTimeOffset representing the current local date and time with system timezone offset
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ offset()

const TimeSpan & nfx::time::DateTimeOffset::offset ( ) const
inlinenodiscardconstexprnoexcept

Get the offset from UTC.

Returns
The TimeSpan representing the offset from UTC
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator+()

DateTimeOffset nfx::time::DateTimeOffset::operator+ ( const TimeSpan & duration) const
inlineconstexprnoexcept

Add time duration.

Parameters
durationThe TimeSpan to add to this DateTimeOffset
Returns
New DateTimeOffset representing this DateTimeOffset plus the duration
Here is the call graph for this function:

◆ operator+=()

DateTimeOffset & nfx::time::DateTimeOffset::operator+= ( const TimeSpan & duration)
inlineconstexprnoexcept

Add time duration (in-place).

Parameters
durationThe TimeSpan to add to this DateTimeOffset
Returns
Reference to this DateTimeOffset after adding the duration
Here is the call graph for this function:

◆ operator-() [1/2]

TimeSpan nfx::time::DateTimeOffset::operator- ( const DateTimeOffset & other) const
inlineconstexprnoexcept

Get time difference between DateTimeOffsets (in UTC).

Parameters
otherThe DateTimeOffset to subtract from this DateTimeOffset
Returns
TimeSpan representing the difference (this - other) in UTC
Here is the call graph for this function:

◆ operator-() [2/2]

DateTimeOffset nfx::time::DateTimeOffset::operator- ( const TimeSpan & duration) const
inlineconstexprnoexcept

Subtract time duration.

Parameters
durationThe TimeSpan to subtract from this DateTimeOffset
Returns
New DateTimeOffset representing this DateTimeOffset minus the duration
Here is the call graph for this function:

◆ operator-=()

DateTimeOffset & nfx::time::DateTimeOffset::operator-= ( const TimeSpan & duration)
inlineconstexprnoexcept

Subtract time duration (in-place).

Parameters
durationThe TimeSpan to subtract from this DateTimeOffset
Returns
Reference to this DateTimeOffset after subtracting the duration
Here is the call graph for this function:

◆ operator<=>()

std::strong_ordering nfx::time::DateTimeOffset::operator<=> ( const DateTimeOffset & other) const
inlineconstexprnoexcept

Three-way comparison operator (compares UTC values).

Parameters
otherThe DateTimeOffset to compare with
Returns
std::strong_ordering indicating the relative order of the two DateTimeOffsets
Here is the call graph for this function:

◆ operator=() [1/2]

DateTimeOffset & nfx::time::DateTimeOffset::operator= ( const DateTimeOffset & )
default

Copy assignment operator.

Returns
Reference to this DateTimeOffset after assignment
Here is the call graph for this function:

◆ operator=() [2/2]

DateTimeOffset & nfx::time::DateTimeOffset::operator= ( DateTimeOffset && )
defaultnoexcept

Move assignment operator.

Returns
Reference to this DateTimeOffset after assignment
Here is the call graph for this function:

◆ operator==()

bool nfx::time::DateTimeOffset::operator== ( const DateTimeOffset & other) const
inlineconstexprnoexcept

Equality comparison (compares UTC values).

Parameters
otherThe DateTimeOffset to compare with
Returns
true if both DateTimeOffsets represent the same UTC instant, false otherwise
Here is the call graph for this function:

◆ second()

std::int32_t nfx::time::DateTimeOffset::second ( ) const
inlinenodiscardnoexcept

Get second component (0-59).

Returns
The second component of this DateTimeOffset (0-59)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ subtract() [1/2]

TimeSpan nfx::time::DateTimeOffset::subtract ( const DateTimeOffset & value) const
inlinenodiscardnoexcept

Subtract DateTimeOffset and return TimeSpan.

Parameters
valueThe DateTimeOffset to subtract from this DateTimeOffset
Returns
TimeSpan representing the difference between the two DateTimeOffsets
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ subtract() [2/2]

DateTimeOffset nfx::time::DateTimeOffset::subtract ( const TimeSpan & value) const
inlinenodiscardnoexcept

Subtract TimeSpan and return DateTimeOffset.

Parameters
valueThe TimeSpan to subtract from this DateTimeOffset
Returns
DateTimeOffset representing this DateTimeOffset minus the time span
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:

◆ ticks()

std::int64_t nfx::time::DateTimeOffset::ticks ( ) const
inlinenodiscardconstexprnoexcept

Get tick count (100-nanosecond units of local time).

Returns
The number of 100-nanosecond intervals representing the local time
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeOfDay()

TimeSpan nfx::time::DateTimeOffset::timeOfDay ( ) const
inlinenodiscardnoexcept

Get time of day as duration since midnight.

Returns
TimeSpan representing the elapsed time since midnight (00:00:00)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ today()

DateTimeOffset nfx::time::DateTimeOffset::today ( )
staticnodiscardnoexcept

Get current local date (time set to 00:00:00).

Returns
DateTimeOffset representing the current local date with time set to 00:00:00
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toEpochMilliseconds()

std::int64_t nfx::time::DateTimeOffset::toEpochMilliseconds ( ) const
inlinenodiscardnoexcept

Convert to Epoch timestamp (milliseconds since epoch).

Returns
Number of milliseconds since Unix epoch (January 1, 1970 00:00:00 UTC)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toEpochSeconds()

std::int64_t nfx::time::DateTimeOffset::toEpochSeconds ( ) const
inlinenodiscardnoexcept

Convert to Epoch timestamp (seconds since epoch).

Returns
Number of seconds since Unix epoch (January 1, 1970 00:00:00 UTC)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toFILETIME()

std::int64_t nfx::time::DateTimeOffset::toFILETIME ( ) const
nodiscardnoexcept

Convert to Windows FILETIME format.

Works on any platform - performs mathematical epoch conversion only. Useful for interoperability with Windows-originated data on any system.

Returns
100-nanosecond intervals since January 1, 1601 UTC
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toIso8601Extended()

std::string nfx::time::DateTimeOffset::toIso8601Extended ( ) const
nodiscard

Convert to ISO 8601 extended format with full precision and offset.

Returns
String representation in ISO 8601 extended format with fractional seconds and offset (e.g., "2024-01-01T12:00:00.1234567+02:00")
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toLocalTime()

DateTimeOffset nfx::time::DateTimeOffset::toLocalTime ( ) const
nodiscardnoexcept

Convert to local time (system timezone).

Returns
DateTimeOffset representing the same instant in local timezone
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toOffset()

DateTimeOffset nfx::time::DateTimeOffset::toOffset ( const TimeSpan & newOffset) const
nodiscardnoexcept

Convert to specified offset.

Parameters
newOffsetThe new timezone offset to convert to
Returns
DateTimeOffset representing the same instant in time with the specified offset
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [1/2]

std::string nfx::time::DateTimeOffset::toString ( ) const
nodiscard

Convert to ISO 8601 string with offset.

Returns
String representation in ISO 8601 format with timezone offset (e.g., "2024-01-01T12:00:00+02:00")
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [2/2]

std::string nfx::time::DateTimeOffset::toString ( DateTime::Format format) const
nodiscard

Convert to string using specified format.

Parameters
formatThe format to use for string conversion
Returns
String representation using the specified format
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:

◆ totalOffsetMinutes()

std::int32_t nfx::time::DateTimeOffset::totalOffsetMinutes ( ) const
inlinenodiscardnoexcept

Get offset in total minutes.

Returns
The total minutes offset from UTC (positive for East, negative for West)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toUniversalTime()

DateTimeOffset nfx::time::DateTimeOffset::toUniversalTime ( ) const
nodiscardnoexcept

Convert to UTC (offset = 00:00:00).

Returns
DateTimeOffset representing the same instant in UTC (offset = 00:00:00)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ utcDateTime()

DateTime nfx::time::DateTimeOffset::utcDateTime ( ) const
nodiscardnoexcept

Get UTC DateTime equivalent.

Returns
The DateTime representing this time in UTC
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ utcNow()

DateTimeOffset nfx::time::DateTimeOffset::utcNow ( )
staticnodiscardnoexcept

Get current UTC time (offset = 00:00:00).

Returns
DateTimeOffset representing the current UTC date and time (offset = 00:00:00)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ utcTicks()

std::int64_t nfx::time::DateTimeOffset::utcTicks ( ) const
inlinenodiscardconstexprnoexcept

Get UTC tick count.

Returns
The number of 100-nanosecond intervals representing the UTC time
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ year()

std::int32_t nfx::time::DateTimeOffset::year ( ) const
inlinenodiscardnoexcept

Get year component (1-9999).

Returns
The year component of this DateTimeOffset (1-9999)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the call graph for this function:
Here is the caller graph for this function:

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