55 #elif defined (__GLIBCXX__) || defined(__APPLE__) || defined(__ANDROID_NDK__)
66 localtime_r( &tt, &tm );
69 Year= tm.tm_year + 1900;
78 #pragma message ("Unknown Platform in file: " __FILE__ )
89 st.wYear= (WORD)
Year;
92 st.wMonth= (WORD)
Month;
93 st.wHour= (WORD)
Hour;
100 #elif defined (__GLIBCXX__) || defined(__APPLE__) || defined(__ANDROID_NDK__)
102 tm.tm_year=
Year - 1900;
125 #pragma message ("Unknown Platform in file: " __FILE__ )
146#define NanosPerDay INT64_C( 86400000000000 )
147#define NanosPerHour INT64_C( 3600000000000 )
148#define NanosPerMinute INT64_C( 60000000000 )
149#define NanosPerSecond INT64_C( 1000000000 )
150#define NanosPerMillisecond INT64_C( 1000000 )
151#define NanosPerMicrosecond INT64_C( 1000 )
157 decltype(nanos) fract;
158 if ( nanos > NanosPerDay ) {
Days=
static_cast<int>( fract= nanos / NanosPerDay ); nanos-= fract * NanosPerDay; }
159 if ( nanos > NanosPerHour ) {
Hours=
static_cast<int>( fract= nanos / NanosPerHour ); nanos-= fract * NanosPerHour; }
160 if ( nanos > NanosPerMinute ) {
Minutes=
static_cast<int>( fract= nanos / NanosPerMinute ); nanos-= fract * NanosPerMinute; }
161 if ( nanos > NanosPerSecond ) {
Seconds=
static_cast<int>( fract= nanos / NanosPerSecond ); nanos-= fract * NanosPerSecond; }
162 if ( nanos > NanosPerMillisecond ) {
Milliseconds=
static_cast<int>( fract= nanos / NanosPerMillisecond ); nanos-= fract * NanosPerMillisecond; }
163 if ( nanos > NanosPerMicrosecond ) {
Microseconds=
static_cast<int>( fract= nanos / NanosPerMicrosecond ); }
168 return Days * NanosPerDay
169 +
Hours * NanosPerHour
184 | uint32_t( cdt.
Month ) << 8
185 | uint32_t( cdt.
Day ) << 3
190 ALIB_ASSERT_ERROR( year >= 0 && year <= 1048575,
"CAMP",
"CalendarDate: Years must be between 0 and 1,048,575." )
191 ALIB_ASSERT_ERROR( month >= 1 && month <= 12 ,
"CAMP",
"CalendarDate: Months must be between 1 and 12." )
192 ALIB_ASSERT_ERROR( day >= 1 && day <= 31 ,
"CAMP",
"CalendarDate: Days must be between 1 and 31." )
193 ALIB_ASSERT_ERROR( dayOfWeek <= 6 ,
"CAMP",
"CalendarDate: Day of week must be either negative or between 0 and 6." )
207 "Day of week does not correspond to given date. Should be: ", cdt.
DayOfWeek )
210 stamp= uint32_t( year ) << 12
211 | uint32_t( month ) << 8
212 | uint32_t( day ) << 3
213 | uint32_t( dayOfWeek ) ;
225 + DateTime::Duration::FromAbsoluteDays( daysToAdd ),
236 if( ( month != 2 && day != 30 )
237 || ( month == 2 && day != 28 ) )
240 && ( day != 29 || month != 2 ) )
270 | ( uint32_t( day-1 ) << 3 )
271 | ( ( (
stamp & 7) + 6 ) % 7 ) ;
int Minute
The calendar minute (0..59).
int Year
The calendar year (e.g., 2022).
int Month
The calendar month (1..12).
ALIB_API void Set(const DateTime &timeStamp, lang::Timezone timezone=lang::Timezone::Local)
int Day
The calendar day (1..31).
int Hour
The calendar hour (0..23).
ALIB_API void Clear()
Sets all public values to 0.
ALIB_API DateTime Get(lang::Timezone timezone=lang::Timezone::Local) const
int Millisecond
The calendar millisecond (0..999).
int Second
The calendar second (0..59).
ALIB_API CalendarDate operator--()
ALIB_API CalendarDate operator+(int daysToAdd) const
CalendarDate()=default
Default constructor leaving this object uninitialized (random value). **************.
ALIB_API DateTime Get(lang::Timezone timezone=lang::Timezone::Local, int hour=12, int minute=0, int second=0) const
uint32_t stamp
Encoded date value.
ALIB_API CalendarDate operator++()
ALIB_API void Set(int year, int month, int day, int dayOfWeek=-1)
int Nanoseconds
The number of nanoseconds (not the total, hence 0-999) within the duration.
ALIB_API int64_t ToNanoSeconds()
int Milliseconds
The number of milliseconds (not the total, hence 0-999) within the duration.
int Seconds
The number of seconds (not the total, hence 0-59) within the duration.
int Microseconds
The number of microseconds (not the total, hence 0-999) within the duration.
int Days
The number of days within the duration.
int Hours
The number of hours (not the total, hence 0-23) within the duration.
ALIB_API void FromNanoSeconds(int64_t nanos)
int Minutes
The number of minutes (not the total, hence 0-59) within the duration.
ALIB_API void Clear()
Sets all public values to 0.
static DateTime FromEpochSeconds(time_t epochSeconds)
time_t InEpochSeconds() const
static ALIB_API DateTime FromSystemTime(const SYSTEMTIME &systemTime, lang::Timezone timezone=lang::Timezone::Local)
ALIB_API SYSTEMTIME ToSystemTime(lang::Timezone timezone=lang::Timezone::Local) const
#define ALIB_ASSERT_ERROR(cond,...)
This is the reference documentation of sub-namespace system of module ALib BaseCamp.
constexpr TIntegral LowerMask()
Timezone
Denotes whether a time value represents local time or UTC.
@ UTC
Denotes UTC (coordinated universal time).
@ Get
Denotes to search data.
lang::system::CalendarDateTime CalendarDateTime
Type alias in namespace alib.