nfx-datetime 0.1.1
Cross-platform C++ DateTime library with 100-nanosecond precision and ISO 8601 support
Loading...
Searching...
No Matches
Constants.h File Reference

DateTime and DateTimeOffset constants for cross-platform compatibility and ISO 8601 support. More...

#include <cstdint>
#include <limits>
#include <string_view>
Include dependency graph for Constants.h:

Go to the source code of this file.

Variables

constexpr std::int32_t nfx::time::constants::MILLISECONDS_PER_SECOND { 1000 }
 Number of milliseconds in a second.
constexpr std::int32_t nfx::time::constants::SECONDS_PER_MINUTE { 60 }
 Number of seconds in a minute.
constexpr std::int32_t nfx::time::constants::SECONDS_PER_HOUR { SECONDS_PER_MINUTE * 60 }
 Number of seconds in an hour (60 minutes × 60 seconds).
constexpr std::int32_t nfx::time::constants::SECONDS_PER_DAY { SECONDS_PER_HOUR * 24 }
 Number of seconds in a day (24 hours × 60 minutes × 60 seconds).
constexpr std::int32_t nfx::time::constants::MINUTES_PER_HOUR { 60 }
 Number of minutes in an hour.
constexpr std::int32_t nfx::time::constants::MINUTES_PER_DAY { MINUTES_PER_HOUR * 24 }
 Number of minutes in a day (24 hours × 60 minutes).
constexpr std::int32_t nfx::time::constants::HOURS_PER_DAY { 24 }
 Number of hours in a day.
constexpr std::int64_t nfx::time::constants::MIN_DATETIME_TICKS { 0LL }
 Minimum DateTime value: January 1, 0001 00:00:00.000 UTC (100-nanosecond ticks).
constexpr std::int64_t nfx::time::constants::MAX_DATETIME_TICKS { 3155378975999999999LL }
 Maximum DateTime value: December 31, 9999 23:59:59.999 UTC (100-nanosecond ticks).
constexpr std::int64_t nfx::time::constants::UNIX_EPOCH_TICKS { 621355968000000000LL }
 Unix epoch: January 1, 1970 00:00:00.000 UTC (100-nanosecond ticks).
constexpr std::int64_t nfx::time::constants::MICROSOFT_FILETIME_EPOCH_TICKS { 504911232000000000LL }
 Microsoft Windows FILETIME epoch: January 1, 1601 00:00:00.000 UTC (100-nanosecond ticks).
constexpr std::int64_t nfx::time::constants::NANOSECONDS_PER_TICK { 100LL }
 Nanoseconds per tick (1 tick = 100 nanoseconds).
constexpr std::int64_t nfx::time::constants::TICKS_PER_MICROSECOND { 10LL }
 Ticks per microsecond (100-nanosecond units).
constexpr std::int64_t nfx::time::constants::TICKS_PER_MILLISECOND { 10000LL }
 Ticks per millisecond (100-nanosecond units).
constexpr std::int64_t nfx::time::constants::TICKS_PER_SECOND { TICKS_PER_MILLISECOND * 1000LL }
 Ticks per second (100-nanosecond units).
constexpr std::int64_t nfx::time::constants::TICKS_PER_MINUTE { TICKS_PER_SECOND * 60LL }
 Ticks per minute (100-nanosecond units).
constexpr std::int64_t nfx::time::constants::TICKS_PER_HOUR { TICKS_PER_MINUTE * 60LL }
 Ticks per hour (100-nanosecond units).
constexpr std::int64_t nfx::time::constants::TICKS_PER_DAY { TICKS_PER_HOUR * 24LL }
 Ticks per day (100-nanosecond units).
constexpr std::int32_t nfx::time::constants::MIN_OFFSET_MINUTES { -14 * 60 }
 Minimum timezone offset in minutes: -14:00 (UTC-14).
constexpr std::int32_t nfx::time::constants::MAX_OFFSET_MINUTES { 14 * 60 }
 Maximum timezone offset in minutes: +14:00 (UTC+14).
constexpr std::int32_t nfx::time::constants::MIN_OFFSET_SECONDS { MIN_OFFSET_MINUTES * 60 }
 Minimum timezone offset in seconds: -14:00:00 (UTC-14).
constexpr std::int32_t nfx::time::constants::MAX_OFFSET_SECONDS { MAX_OFFSET_MINUTES * 60 }
 Maximum timezone offset in seconds: +14:00:00 (UTC+14).
constexpr std::int32_t nfx::time::constants::UTC_OFFSET { 0 }
 UTC offset (zero).
constexpr std::int32_t nfx::time::constants::MIN_YEAR { 1 }
 Minimum year value.
constexpr std::int32_t nfx::time::constants::MAX_YEAR { 9999 }
 Maximum year value.
constexpr std::int32_t nfx::time::constants::DAYS_PER_400_YEARS { 146097 }
 Days per 400-year cycle (Gregorian calendar).
constexpr std::int32_t nfx::time::constants::DAYS_PER_100_YEARS { 36524 }
 Days per 100-year cycle (Gregorian calendar).
constexpr std::int32_t nfx::time::constants::DAYS_PER_4_YEARS { 1461 }
 Days per 4-year cycle (Gregorian calendar).
constexpr std::int32_t nfx::time::constants::DAYS_PER_YEAR { 365 }
 Days per year (non-leap).
constexpr std::string_view nfx::time::constants::ISO8601_BASIC_PATTERN { "yyyy-MM-ddTHH:mm:ssZ" }
 Basic ISO 8601 datetime format pattern.
constexpr std::string_view nfx::time::constants::ISO8601_EXTENDED_PATTERN { "yyyy-MM-ddTHH:mm:ss.fffffffK" }
 Extended ISO 8601 datetime format pattern with fractional seconds.
constexpr std::string_view nfx::time::constants::ISO8601_DATE_PATTERN { "yyyy-MM-dd" }
 ISO 8601 date-only format pattern.
constexpr std::string_view nfx::time::constants::ISO8601_TIME_PATTERN { "HH:mm:ss" }
 ISO 8601 time-only format pattern.
constexpr std::size_t nfx::time::constants::MAX_ISO8601_LENGTH { 35 }
 Maximum length of ISO 8601 datetime string.
constexpr std::size_t nfx::time::constants::MIN_ISO8601_LENGTH { 20 }
 Minimum length of ISO 8601 datetime string.
constexpr std::size_t nfx::time::constants::MAX_UNIX_SECONDS_LENGTH { 10 }
 Maximum length of Unix timestamp in seconds (10 digits for year 2286).
constexpr std::size_t nfx::time::constants::MAX_UNIX_MILLISECONDS_LENGTH { 13 }
 Maximum length of Unix timestamp in milliseconds (13 digits).
constexpr std::size_t nfx::time::constants::CURRENT_UNIX_SECONDS_LENGTH { 10 }
 Current typical length of Unix timestamp in seconds (10 digits until 2286).

Detailed Description

DateTime and DateTimeOffset constants for cross-platform compatibility and ISO 8601 support.

Defines boundary values, timezone limits, and time unit constants for cross-platform DateTime operations with ISO 8601 standard compliance

Definition in file Constants.h.

Variable Documentation

◆ CURRENT_UNIX_SECONDS_LENGTH

std::size_t nfx::time::constants::CURRENT_UNIX_SECONDS_LENGTH { 10 }
inlineconstexpr

Current typical length of Unix timestamp in seconds (10 digits until 2286).

Definition at line 202 of file Constants.h.

◆ DAYS_PER_100_YEARS

std::int32_t nfx::time::constants::DAYS_PER_100_YEARS { 36524 }
inlineconstexpr

Days per 100-year cycle (Gregorian calendar).

Definition at line 147 of file Constants.h.

◆ DAYS_PER_400_YEARS

std::int32_t nfx::time::constants::DAYS_PER_400_YEARS { 146097 }
inlineconstexpr

Days per 400-year cycle (Gregorian calendar).

Definition at line 144 of file Constants.h.

◆ DAYS_PER_4_YEARS

std::int32_t nfx::time::constants::DAYS_PER_4_YEARS { 1461 }
inlineconstexpr

Days per 4-year cycle (Gregorian calendar).

Definition at line 150 of file Constants.h.

◆ DAYS_PER_YEAR

std::int32_t nfx::time::constants::DAYS_PER_YEAR { 365 }
inlineconstexpr

Days per year (non-leap).

Definition at line 153 of file Constants.h.

◆ HOURS_PER_DAY

std::int32_t nfx::time::constants::HOURS_PER_DAY { 24 }
inlineconstexpr

Number of hours in a day.

Definition at line 63 of file Constants.h.

◆ ISO8601_BASIC_PATTERN

std::string_view nfx::time::constants::ISO8601_BASIC_PATTERN { "yyyy-MM-ddTHH:mm:ssZ" }
inlineconstexpr

Basic ISO 8601 datetime format pattern.

Definition at line 164 of file Constants.h.

◆ ISO8601_DATE_PATTERN

std::string_view nfx::time::constants::ISO8601_DATE_PATTERN { "yyyy-MM-dd" }
inlineconstexpr

ISO 8601 date-only format pattern.

Definition at line 170 of file Constants.h.

◆ ISO8601_EXTENDED_PATTERN

std::string_view nfx::time::constants::ISO8601_EXTENDED_PATTERN { "yyyy-MM-ddTHH:mm:ss.fffffffK" }
inlineconstexpr

Extended ISO 8601 datetime format pattern with fractional seconds.

Definition at line 167 of file Constants.h.

◆ ISO8601_TIME_PATTERN

std::string_view nfx::time::constants::ISO8601_TIME_PATTERN { "HH:mm:ss" }
inlineconstexpr

ISO 8601 time-only format pattern.

Definition at line 173 of file Constants.h.

◆ MAX_DATETIME_TICKS

std::int64_t nfx::time::constants::MAX_DATETIME_TICKS { 3155378975999999999LL }
inlineconstexpr

Maximum DateTime value: December 31, 9999 23:59:59.999 UTC (100-nanosecond ticks).

Definition at line 73 of file Constants.h.

◆ MAX_ISO8601_LENGTH

std::size_t nfx::time::constants::MAX_ISO8601_LENGTH { 35 }
inlineconstexpr

Maximum length of ISO 8601 datetime string.

"2024-12-31T23:59:59.9999999+14:00" format

Definition at line 183 of file Constants.h.

◆ MAX_OFFSET_MINUTES

std::int32_t nfx::time::constants::MAX_OFFSET_MINUTES { 14 * 60 }
inlineconstexpr

Maximum timezone offset in minutes: +14:00 (UTC+14).

Definition at line 114 of file Constants.h.

◆ MAX_OFFSET_SECONDS

std::int32_t nfx::time::constants::MAX_OFFSET_SECONDS { MAX_OFFSET_MINUTES * 60 }
inlineconstexpr

Maximum timezone offset in seconds: +14:00:00 (UTC+14).

Definition at line 120 of file Constants.h.

◆ MAX_UNIX_MILLISECONDS_LENGTH

std::size_t nfx::time::constants::MAX_UNIX_MILLISECONDS_LENGTH { 13 }
inlineconstexpr

Maximum length of Unix timestamp in milliseconds (13 digits).

Definition at line 199 of file Constants.h.

◆ MAX_UNIX_SECONDS_LENGTH

std::size_t nfx::time::constants::MAX_UNIX_SECONDS_LENGTH { 10 }
inlineconstexpr

Maximum length of Unix timestamp in seconds (10 digits for year 2286).

Definition at line 196 of file Constants.h.

◆ MAX_YEAR

std::int32_t nfx::time::constants::MAX_YEAR { 9999 }
inlineconstexpr

Maximum year value.

Definition at line 137 of file Constants.h.

◆ MICROSOFT_FILETIME_EPOCH_TICKS

std::int64_t nfx::time::constants::MICROSOFT_FILETIME_EPOCH_TICKS { 504911232000000000LL }
inlineconstexpr

Microsoft Windows FILETIME epoch: January 1, 1601 00:00:00.000 UTC (100-nanosecond ticks).

Definition at line 79 of file Constants.h.

◆ MILLISECONDS_PER_SECOND

std::int32_t nfx::time::constants::MILLISECONDS_PER_SECOND { 1000 }
inlineconstexpr

Number of milliseconds in a second.

Definition at line 45 of file Constants.h.

◆ MIN_DATETIME_TICKS

std::int64_t nfx::time::constants::MIN_DATETIME_TICKS { 0LL }
inlineconstexpr

Minimum DateTime value: January 1, 0001 00:00:00.000 UTC (100-nanosecond ticks).

Definition at line 70 of file Constants.h.

◆ MIN_ISO8601_LENGTH

std::size_t nfx::time::constants::MIN_ISO8601_LENGTH { 20 }
inlineconstexpr

Minimum length of ISO 8601 datetime string.

"2024-01-01T00:00:00Z" format

Definition at line 189 of file Constants.h.

◆ MIN_OFFSET_MINUTES

std::int32_t nfx::time::constants::MIN_OFFSET_MINUTES { -14 * 60 }
inlineconstexpr

Minimum timezone offset in minutes: -14:00 (UTC-14).

Definition at line 111 of file Constants.h.

◆ MIN_OFFSET_SECONDS

std::int32_t nfx::time::constants::MIN_OFFSET_SECONDS { MIN_OFFSET_MINUTES * 60 }
inlineconstexpr

Minimum timezone offset in seconds: -14:00:00 (UTC-14).

Definition at line 117 of file Constants.h.

◆ MIN_YEAR

std::int32_t nfx::time::constants::MIN_YEAR { 1 }
inlineconstexpr

Minimum year value.

Definition at line 134 of file Constants.h.

◆ MINUTES_PER_DAY

std::int32_t nfx::time::constants::MINUTES_PER_DAY { MINUTES_PER_HOUR * 24 }
inlineconstexpr

Number of minutes in a day (24 hours × 60 minutes).

Definition at line 60 of file Constants.h.

◆ MINUTES_PER_HOUR

std::int32_t nfx::time::constants::MINUTES_PER_HOUR { 60 }
inlineconstexpr

Number of minutes in an hour.

Definition at line 57 of file Constants.h.

◆ NANOSECONDS_PER_TICK

std::int64_t nfx::time::constants::NANOSECONDS_PER_TICK { 100LL }
inlineconstexpr

Nanoseconds per tick (1 tick = 100 nanoseconds).

Definition at line 86 of file Constants.h.

◆ SECONDS_PER_DAY

std::int32_t nfx::time::constants::SECONDS_PER_DAY { SECONDS_PER_HOUR * 24 }
inlineconstexpr

Number of seconds in a day (24 hours × 60 minutes × 60 seconds).

Definition at line 54 of file Constants.h.

◆ SECONDS_PER_HOUR

std::int32_t nfx::time::constants::SECONDS_PER_HOUR { SECONDS_PER_MINUTE * 60 }
inlineconstexpr

Number of seconds in an hour (60 minutes × 60 seconds).

Definition at line 51 of file Constants.h.

◆ SECONDS_PER_MINUTE

std::int32_t nfx::time::constants::SECONDS_PER_MINUTE { 60 }
inlineconstexpr

Number of seconds in a minute.

Definition at line 48 of file Constants.h.

◆ TICKS_PER_DAY

std::int64_t nfx::time::constants::TICKS_PER_DAY { TICKS_PER_HOUR * 24LL }
inlineconstexpr

Ticks per day (100-nanosecond units).

Definition at line 104 of file Constants.h.

◆ TICKS_PER_HOUR

std::int64_t nfx::time::constants::TICKS_PER_HOUR { TICKS_PER_MINUTE * 60LL }
inlineconstexpr

Ticks per hour (100-nanosecond units).

Definition at line 101 of file Constants.h.

◆ TICKS_PER_MICROSECOND

std::int64_t nfx::time::constants::TICKS_PER_MICROSECOND { 10LL }
inlineconstexpr

Ticks per microsecond (100-nanosecond units).

Definition at line 89 of file Constants.h.

◆ TICKS_PER_MILLISECOND

std::int64_t nfx::time::constants::TICKS_PER_MILLISECOND { 10000LL }
inlineconstexpr

Ticks per millisecond (100-nanosecond units).

Definition at line 92 of file Constants.h.

◆ TICKS_PER_MINUTE

std::int64_t nfx::time::constants::TICKS_PER_MINUTE { TICKS_PER_SECOND * 60LL }
inlineconstexpr

Ticks per minute (100-nanosecond units).

Definition at line 98 of file Constants.h.

◆ TICKS_PER_SECOND

std::int64_t nfx::time::constants::TICKS_PER_SECOND { TICKS_PER_MILLISECOND * 1000LL }
inlineconstexpr

Ticks per second (100-nanosecond units).

Definition at line 95 of file Constants.h.

◆ UNIX_EPOCH_TICKS

std::int64_t nfx::time::constants::UNIX_EPOCH_TICKS { 621355968000000000LL }
inlineconstexpr

Unix epoch: January 1, 1970 00:00:00.000 UTC (100-nanosecond ticks).

Definition at line 76 of file Constants.h.

◆ UTC_OFFSET

std::int32_t nfx::time::constants::UTC_OFFSET { 0 }
inlineconstexpr

UTC offset (zero).

Definition at line 123 of file Constants.h.