ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
calendar.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of sub-namespace #alib::strings::util of module \alib_strings of
4/// the \aliblong.
5///
6/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
7/// Published under \ref mainpage_license "Boost Software License".
8//==================================================================================================
9ALIB_EXPORT namespace alib { namespace strings::util {
10
11//==================================================================================================
12/// This class represents a point in time as a set of calendar and clock values
13/// (year, month, day, hour, ...).
14/// It provides methods to convert to and from objects of type \alib{time;DateTime}.
15/// In addition, a method to format the date and time into human-readable string value is available.
16///
17/// \note
18/// The conversion from and into objects of type \alib{time;Ticks} is intentionally not supported.
19/// In the case that such objects should be used with this class, an additional conversion
20/// step has to be performed using class \alib{time;TickConverter}. In other words, conversion can
21/// be performed as follows:
22///
23/// CalendarDateTime <=> DateTime <=> Ticks
24/// <p>
25/// \note
26/// This class is using system-specific calendar methods and relies on the locale and time zone
27/// settings of the machine.
28//==================================================================================================
30{
31 public:
32 /// A list of month names used with the method
33 /// \alib{strings::util;CalendarDateTime::Format}.
34 ///
35 /// If module \alib_camp is not included in the \alibbuild, the values default to:
36 /// \snippet "strings/util/calendar.cpp" CDT_MONTH_NAMES
37 /// In case the module is included, the same values are resourced in #alib::BASECAMP under
38 /// key <c>"Months"</c>. In both cases a user might change this during bootstrap.
40
41 /// A list of day names used with the method \alib{strings::util;CalendarDateTime::Format}.
42 ///
43 /// If module \alib_camp is not included in the \alibbuild, the values default to:
44 /// \snippet "strings/util/calendar.cpp" CDT_DAY_NAMES
45 /// In case the module is included, the same values are resourced in #alib::BASECAMP under
46 /// key <c>"Days"</c>. In both cases a user might change this during bootstrap.
48
49 /// The calendar year (e.g., 2022).
50 int Year;
51
52 /// The calendar month (1..12).
53 int Month;
54
55 /// The calendar day (1..31).
56 int Day;
57
58 /// The calendar hour (0..23).
59 int Hour;
60
61 /// The calendar minute (0..59).
62 int Minute;
63
64 /// The calendar second (0..59).
65 int Second;
66
67 /// The calendar millisecond (0..999).
69
70 /// The calendar day of week (0==Sunday..6==Saturday).
71 /// \attention This value is only set when constructed with a \b DateTime object and
72 /// set to \c -1 if constructed with single values, or if method #Clear is
73 /// invoked.
75 /// Constructs an unset object.
76 /// @param init If \b Initialization::Default or \b nulled, #Clear is invoked.
77 /// Otherwise fields are not initialized.
78 /// Defaults to \c Initialization::Default.
84
85 /// Constructs the object according to the given timestamp object and time zone.
86 /// @param timeStamp The point in time to use for setting the public fields
87 /// @param timezone Denotes if the time that is calculated should be local or UTC.
88 /// Defaults to \c TimeZone::Local.
90 { Set( timeStamp, timezone ); }
91
92 /// Constructs the object according to the given date and time values.
93 /// @param year The year of the calendar time.
94 /// @param month The month of the calendar time.
95 /// @param day The day of the calendar time.
96 /// @param hour The hour of the calendar time.
97 /// @param minute The minute of the calendar time.
98 /// @param second The second of the calendar time.
99 /// @param millisecond The millisecond of the calendar time.
100 CalendarDateTime( int year , int month= 1 , int day= 1,
101 int hour= 0, int minute= 0, int second= 0, int millisecond= 0 )
102 : Year ( year )
103 , Month ( month )
104 , Day ( day )
105 , Hour ( hour )
106 , Minute ( minute )
107 , Second ( second )
108 , Millisecond ( millisecond)
109 , DayOfWeek ( -1 ) {}
110
111 /// Sets the public fields according to the given timestamp object.
112 /// @param timeStamp The point in time to use for setting the public fields
113 /// @param timezone Denotes if the time that is calculated should be local or UTC.
114 /// Defaults to \c TimeZone::Local.
116 void Set( const DateTime& timeStamp, lang::Timezone timezone =lang::Timezone::Local );
117
118 /// Creates a \b DateTime object from this calendar date.
119 /// \attention
120 /// The resolution and possible time range of class \b %DateTime is platform-dependent.
121 /// This method must not be used if inconsistent values are stored.
122 ///
123 /// @param timezone Denote if the time that is calculated should be local or UTC.
124 /// Defaults to \c TimeZone::Local.
125 /// @returns The point in time represented by the public fields of this class.
128
129 /// Sets all public values to \c 0.
131 void Clear();
132
133 /// Formats the date using a given pattern string. Within the pattern string, different symbols
134 /// are interpreted as tokens. The format is compatible with C# time format strings, as well as
135 /// with class SimpleDateFormat of the Java APIs.<br>
136 /// Strings within the format text that should not be interpreted as tokens may be surrounded
137 /// by single quotes.
138 /// Strings within the format text that should not be interpreted as tokens may be given
139 /// in single quotes.
140 /// Two consecutive single quotes will be replaced to one single quote.<br>
141 ///
142 /// <center>Token</center> | <center>Description</center>
143 /// - - - - -| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
144 /// y |The year with as many digits as it has (for current dates this is 4).</TD> </TR>
145 /// yy |The year, truncated to 2 digits (modulo 100).</TD> </TR>
146 /// yyy...y |The year with a minimum amount of digits as amount of y-characters given.</TD> </TR>
147 /// M |The month as numbers from 1..12.</TD> </TR>
148 /// MM |The month as numbers from 01..12.</TD> </TR>
149 /// MMM |The month as abbreviated, 3-digit word defined by resourced strings (defaults to English language).</TD> </TR>
150 /// MMMM |The month as word defined by resourced strings (defaults to English language).</TD> </TR>
151 /// d |The day as numbers from 1..31.</TD> </TR>
152 /// dd |The day as numbers from 01..31.</TD> </TR>
153 /// ddd |The day as abbreviated, 3-digit word defined by resourced strings (defaults to English language).</TD> </TR>
154 /// dddd |The day as word defined by resourced strings (defaults to English language).</TD> </TR>
155 /// H |The hour as numbers from 0..23.</TD> </TR>
156 /// HH |The hour as numbers from 00..23.</TD> </TR>
157 /// K |The hour as numbers from 0..11 am/pm.</TD> </TR>
158 /// KK |The hour as numbers from 00..11 am/pm.</TD> </TR>
159 /// m |The minute as numbers from 0..59.</TD> </TR>
160 /// mm |The minute as numbers from 00..59.</TD> </TR>
161 /// s |The second as numbers from 0..59.</TD> </TR>
162 /// ss |The second as numbers from 00..59.</TD> </TR>
163 ///
164 /// @param format The format pattern string.
165 /// @param target A reference to an AString that gets the result of the format processing
166 /// appended.
167 /// @param targetData If \c CurrentData::Keep (the default) the string is appended to \p{target}.
168 /// if \c CurrentData::Clear, \p{target} is cleared.
169 /// @returns \p{target} (for convenience).
173};
174
175//==================================================================================================
176/// This class represents a time span, measured in human units like days, hours, minutes and so on.
177/// Besides conversion from and to nanoseconds, conversions from and to objects of types
178/// \alib{time;TimePointBase::Duration;DateTime::Duration} and
179/// \alib{time;TimePointBase::Duration;Ticks::Duration} is supported.
180//==================================================================================================
182{
183 public:
184 /// The number of days within the duration
185 int Days;
186
187 /// The number of hours (not the total, hence 0-23) within the duration.
188 int Hours;
189
190 /// The number of minutes (not the total, hence 0-59) within the duration.
192
193 /// The number of seconds (not the total, hence 0-59) within the duration.
195
196 /// The number of milliseconds (not the total, hence 0-999) within the duration.
198
199 /// The number of microseconds (not the total, hence 0-999) within the duration.
201
202 /// The number of nanoseconds (not the total, hence 0-999) within the duration.
204
205 /// Constructs the object to represent a duration of 0. (Sets all public fields to 0.)
206 /// @param init If \b Initialization::Default or \b Nulled, #Clear is invoked.
207 /// Otherwise fields are not initialized.
208 /// Defaults to \b Initialization::Default.
214
215 /// Constructs the object using the given duration measured in nanoseconds.
216 /// Invokes #FromNanoSeconds.
217 /// @param nanos The duration to use for setting the public fields.
218 CalendarDuration( int64_t nanos ) { FromNanoSeconds( nanos ); }
219
220 /// Constructs the object using the given duration object.
221 /// Invokes #FromDuration.
222 /// @param duration The duration to use for setting the public fields.
223 CalendarDuration( DateTime::Duration duration ) { FromDuration( duration ); }
224
225 /// Constructs the object using the given duration object.
226 /// Invokes #FromDuration.
227 /// @param duration The duration to use for setting the public fields.
228 CalendarDuration( Ticks::Duration duration ) { FromDuration( duration ); }
229
230 /// Sets the public fields to represent the given duration value.
231 /// The state of the object will hereafter be the same as it was when constructed with the same
232 /// parameter.
233 /// @param duration The duration to use for setting the public fields.
234 void FromDuration( DateTime::Duration duration )
235 { FromNanoSeconds( duration.InNanoseconds() ); }
236
237 /// Sets the public fields to represent the given duration value.
238 /// The state of the object will hereafter be the same as it was when constructed with the same
239 /// parameter.
240 /// @param duration The duration to use for setting the public fields.
241 void FromDuration( Ticks::Duration duration )
242 { FromNanoSeconds( duration.InNanoseconds() ); }
243
244 /// Takes the current values of the public fields and returns a duration value compatible with
245 /// class \b %DateTime.
246 /// @returns The duration represented by the public fields of this class.
247 DateTime::Duration ToDateTimeDuration()
248 { return DateTime::Duration::FromNanoseconds( ToNanoSeconds() ); }
249
250 /// Takes the current values of the public fields and returns a duration value compatible with
251 /// class \b %Ticks.
252 /// @returns The duration represented by the public fields of this class.
253 Ticks::Duration ToTicksDuration()
254 { return Ticks::Duration::FromNanoseconds( ToNanoSeconds() ); }
255
256 /// Sets the public fields to represent the given duration value.
257 /// The state of the object will hereafter be the same as it was when constructed with the same
258 /// parameter.
259 /// @param nanos The duration to use for setting the public fields.
260 ALIB_DLL void FromNanoSeconds( int64_t nanos );
261
262 /// Takes the current values of the public fields and returns the duration.
263 /// @returns The duration represented by the public fields of this class in nanoseconds.
264 ALIB_DLL int64_t ToNanoSeconds();
265
266 /// Sets all public values to 0.
267 ALIB_DLL void Clear();
268};
269
270//==================================================================================================
271/// Represents a date in the systems calendar without the provision of a clock time.
272/// This class internally uses types \alib{time;DateTime} and \alib{strings::util;CalendarDateTime}
273/// to perform operators <c>+</c>, <c>-</c>, <c>+=</c> and <c>-=</c>, but is much more efficient
274/// with in- and decrement operators <c>++</c> and <c>--</c>. Furthermore it uses only 32-bits of
275/// storage.
276///
277/// Besides storing clock-time agnostic date values, the type is useful to securely iterate over
278/// dates, because there is no risk of false comparisons due to mixed time-zone and daylight
279/// saving properties and in general due to arbitrarily set clock times.
280///
281/// Another small difference is that field \alib{strings::util::CalendarDate;DayOfWeek} is always
282/// kept in a reliable (correct) state, which is not the case with field
283/// \alib{strings::util;CalendarDateTime::DayOfWeek}.
284///
285/// Internally, the values are stored a 32-bit storage word using the following scheme
286/// - bits 1-3 encode the day of week (from 0 (= Sunday) to 6 (= Saturday)
287/// - bits 4-8 encode the calendar day (1..31)
288/// - bits 9-12 encode the calendar month (1..12)
289/// - bits 13-32 encode the calendar year
290/// consequently, for the calendar year 20 bits are available, which evaluates to a range of
291/// \b 1,048,576 years.
292/// For simplicity and speed, the values are \b not defined in accordance to class
293/// \alib{strings::util;CalendarDateTime}, where a value of \c 0 represents year \b 1900.
294/// This class just stores the year value as is and does not allow negative values.
295/// As a result, this class is capable of storing values between <b>1/1/0000</b> and
296/// <b>12/31/1,048,576</b>.
297//==================================================================================================
299{
300 protected:
301 uint32_t stamp; ///< Encoded date value.
302
303 //################################################################################################
304 // Conversion to time platform/language specific values
305 //################################################################################################
306 public:
307 /// Default constructor leaving this object uninitialized (random value).
308 CalendarDate() =default;
309
310 /// Trivial default copy constructor.
311 CalendarDate( const CalendarDate& ) noexcept =default;
312
313 /// Trivial default move constructor.
314 CalendarDate( CalendarDate&& ) noexcept =default;
315
316 /// Trivial default copy assign operator.
317 /// @return A reference to \c this.
318 CalendarDate& operator=( const CalendarDate& ) noexcept =default;
319
320 /// Trivial default move assign operator.
321 /// @return A reference to \c this.
322 CalendarDate& operator=( CalendarDate&& ) noexcept =default;
323
324 /// Trivial default destructor.
325 ~CalendarDate() noexcept =default;
326
327 /// Constructor taking the date as separated values.
328 /// @param year The year to use. Must be between 0 and 1,048,575
329 /// @param month The month to use. Must be between 1 and 12
330 /// @param day The day to use. Must be between 1 and 31
331 /// @param dayOfWeek The day of week that results from the previous values.
332 /// Defaults to \c -1 which instructs this constructor to retrieve that
333 /// correct value.<br>
334 /// If given, values must be between 0 (Sunday) and 6 (Saturday).
335 /// In debug compilations an assertion will be raised if the
336 /// value is out of range or inconsistent.
337 CalendarDate(int year, int month, int day, int dayOfWeek= -1)
338 { Set( year, month, day, dayOfWeek ); }
339
340 /// Constructor creating a date that represents "today".
341 /// @param timezone Determines whether the local time zone should be used or UTC.
342 explicit
345
346 /// Constructor taking a \b DateTime value.
347 /// @param calendarDateTime The value to take the date from.
348 ALIB_DLL explicit
349 CalendarDate( const CalendarDateTime& calendarDateTime ) {
350 Set( calendarDateTime.Year
351 ,calendarDateTime.Month
352 ,calendarDateTime.Day
353 ,calendarDateTime.DayOfWeek );
354 }
355
356 /// Constructor taking a \b DateTime value.
357 /// @param dateTime The value to take the date from.
358 /// @param timezone Determines whether the local time zone should be used or UTC.
359 CalendarDate( const DateTime& dateTime, lang::Timezone timezone ) { Set( dateTime, timezone); }
360
361
362 /// Sets this class to the given values.
363 /// @param year The year to use. Must be between 0 and 1,048,575
364 /// @param month The month to use. Must be between 1 and 12
365 /// @param day The day to use. Must be between 1 and 31
366 /// @param dayOfWeek The day of week that results from the previous values.
367 /// Defaults to \c -1 which instructs this constructor to retrieve that
368 /// correct value.<br>
369 /// If given, values must be between 0 (Sunday) and 6 (Saturday).
370 /// In debug compilations an assertion will be raised if the
371 /// value is out of range or inconsistent.
373 void Set( int year, int month, int day, int dayOfWeek= -1);
374
375 /// Sets this class to the date represented by the given \b DateTime instance.
376 /// @param dateTime The value to take the date from.
377 /// @param timezone Determines whether the local time zone applies to \p{dateTime} or
378 /// whether it refers to UTC.
380 void Set( const DateTime& dateTime, lang::Timezone timezone );
381
382 /// Creates a \b DateTime object from this calendar date.
383 /// \attention
384 /// The resolution and possible time range of class \b %DateTime is platform-dependent.
385 /// This method must not be used if inconsistent values are stored.
386 ///
387 /// @param timezone Denote if the time that is calculated should be local or UTC.
388 /// Defaults to \c TimeZone::Local.
389 /// @param hour The hour of day (0..23) that the value returned should represent.
390 /// Defaults to noon time (\c 12).
391 /// @param minute The minute of the hour (0..59) that the value returned should represent.
392 /// Defaults to \c 0.
393 /// @param second The second of the minute (0..59) that the value returned should
394 /// represent. Defaults to \c 0.
395 /// @returns The point in time represented by this class and the given clock values.
398 int hour= 12, int minute= 0, int second= 0 ) const;
399
400 /// Returns a date and time value, by adding 12 o'clock noon time.
401 /// @return A corresponding \b DateTime value.
404
405 //---------------------------- Year(), Month(), Day(), DayOfWeek() ---------------------------
406 /// Extracts the day of month from this date as a value between \c 1 and \c 31.
407 /// @return The calendar day of month.
408 int Year() const { return int( stamp >> 12 ); }
409
410 /// Extracts the month from this date as a value between \c 1 and \c 12.
411 /// @return The calendar day of month.
412 int Month() const { return int( (stamp >> 8) & 15 ); }
413
414 /// Extracts the day of month from this date as a value between \c 1 and \c 31.
415 /// @return The calendar day of month.
416 int Day() const { return int( (stamp >> 3) & 31 ); }
417
418 /// Extracts the day of week from this date as a value between \c 0 (representing sunday)
419 /// and \c 6 (representing Saturday) in accordance with field
420 /// \alib{strings::util;CalendarDateTime::DayOfWeek}.
421 /// @return The calendar day of month.
422 int DayOfWeek() const { return int( stamp & 7 ); }
423
424 //--------------------------------------------- +/ -------------------------------------------
425
426 /// Adds the given number of days to this date.
427 /// @param daysToAdd The days to add. May be negative for subtraction.
428 /// @return A copy of this object after modification.
430 CalendarDate operator+ ( int daysToAdd ) const;
431
432 /// Subtracts the given number of days to this date.
433 /// @param daysToSubtract The days to add. May be negative for additions.
434 /// @return A copy of this object after modification.
435 CalendarDate operator- ( int daysToSubtract ) const { return (*this) + (-daysToSubtract); }
436
437 /// Prefix increment operator.
438 /// @return A copy of this object after modification.
441
442 /// Prefix decrement operator.
443 /// @return A copy of this object after modification.
446
447 /// Postfix increment operator.
448 /// @return A copy of this object before its modification.
450 auto tmp = *this;
451 ++(*this);
452 return tmp;
453 }
454
455 /// Postfix decrement operator.
456 /// @return A copy of this object before its modification.
458 auto tmp = *this;
459 --(*this);
460 return tmp;
461 }
462
463 /// Adds the given number of days to this date.
464 /// @param daysToAdd The days to add. May be negative for subtraction.
465 /// @return A copy of this object after modification.
466 CalendarDate operator+=( int daysToAdd ) { return (*this)= (*this) + daysToAdd; }
467
468 /// Subtracts the given number of days to this date.
469 /// @param daysToSubtract The days to add. May be negative for additons.
470 /// @return A copy of this object after modification.
471 CalendarDate operator-=( int daysToSubtract ) { return (*this)+= (- daysToSubtract); }
472
473
474 //----------------------------------------- Comparison ---------------------------------------
475 /// Equal to operator.
476 /// @param other The date stamp to compare.
477 /// @return The result of the comparison.
478 bool operator==( const CalendarDate& other ) const { return stamp == other.stamp; }
479
480 /// Not equal to operator.
481 /// @param other The date stamp to compare.
482 /// @return The result of the comparison.
483 bool operator!=( const CalendarDate& other ) const { return stamp != other.stamp; }
484
485 /// Less than operator.
486 /// @param other The date stamp to compare.
487 /// @return A reference to this object.
488 bool operator<( const CalendarDate& other ) const { return stamp < other.stamp; }
489
490 /// Less than or equal to operator.
491 /// @param other The date stamp to compare.
492 /// @return The result of the comparison.
493 bool operator<=( const CalendarDate& other ) const
494 { return stamp <= other.stamp; }
495
496 /// Greater than operator.
497 /// @param other The date stamp to compare.
498 /// @return The result of the comparison.
499 bool operator>( const CalendarDate& other ) const { return stamp > other.stamp; }
500
501 /// Greater than or equal to operator.
502 /// @param other The date stamp to compare.
503 /// @return The result of the comparison.
504 bool operator>=( const CalendarDate& other ) const
505 { return stamp >= other.stamp; }
506}; // class CalendarDate
507
508
509} // namespace alib[::strings::util]
510
511/// Type alias in namespace \b alib.
513
514/// Type alias in namespace \b alib.
516
517/// Type alias in namespace \b alib.
519
520} // namespace [alib]
int Minute
The calendar minute (0..59).
Definition calendar.inl:62
ALIB_DLL void Set(const DateTime &timeStamp, lang::Timezone timezone=lang::Timezone::Local)
Definition calendar.cpp:74
int Second
The calendar second (0..59).
Definition calendar.inl:65
CalendarDateTime(const DateTime &timeStamp, lang::Timezone timezone=lang::Timezone::Local)
Definition calendar.inl:89
int Day
The calendar day (1..31).
Definition calendar.inl:56
CalendarDateTime(lang::Initialization init=lang::Initialization::Default)
Definition calendar.inl:79
ALIB_DLL AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep) const
Definition calendar.cpp:293
int Hour
The calendar hour (0..23).
Definition calendar.inl:59
static ALIB_DLL String MONTH_NAMES[12]
Definition calendar.inl:39
int Year
The calendar year (e.g., 2022).
Definition calendar.inl:50
CalendarDateTime(int year, int month=1, int day=1, int hour=0, int minute=0, int second=0, int millisecond=0)
Definition calendar.inl:100
ALIB_DLL DateTime Get(lang::Timezone timezone=lang::Timezone::Local) const
Definition calendar.cpp:112
ALIB_DLL void Clear()
Sets all public values to 0.
Definition calendar.cpp:63
static ALIB_DLL String DAY_NAMES[7]
Definition calendar.inl:47
int Month
The calendar month (1..12).
Definition calendar.inl:53
int Millisecond
The calendar millisecond (0..999).
Definition calendar.inl:68
bool operator>(const CalendarDate &other) const
Definition calendar.inl:499
CalendarDate()=default
Default constructor leaving this object uninitialized (random value).
ALIB_DLL void Set(int year, int month, int day, int dayOfWeek=-1)
Definition calendar.cpp:210
bool operator==(const CalendarDate &other) const
Definition calendar.inl:478
ALIB_DLL CalendarDateTime ToCalendarDateTime() const
ALIB_DLL CalendarDate operator++()
Definition calendar.cpp:246
CalendarDate operator-(int daysToSubtract) const
Definition calendar.inl:435
CalendarDate(const DateTime &dateTime, lang::Timezone timezone)
Definition calendar.inl:359
bool operator!=(const CalendarDate &other) const
Definition calendar.inl:483
uint32_t stamp
Encoded date value.
Definition calendar.inl:301
ALIB_DLL CalendarDate(const CalendarDateTime &calendarDateTime)
Definition calendar.inl:349
CalendarDate(const CalendarDate &) noexcept=default
Trivial default copy constructor.
CalendarDate operator+=(int daysToAdd)
Definition calendar.inl:466
CalendarDate operator-=(int daysToSubtract)
Definition calendar.inl:471
CalendarDate(CalendarDate &&) noexcept=default
Trivial default move constructor.
ALIB_DLL DateTime Get(lang::Timezone timezone=lang::Timezone::Local, int hour=12, int minute=0, int second=0) const
Definition calendar.cpp:236
bool operator<=(const CalendarDate &other) const
Definition calendar.inl:493
bool operator>=(const CalendarDate &other) const
Definition calendar.inl:504
CalendarDate(lang::Timezone timezone)
Definition calendar.inl:343
ALIB_DLL CalendarDate operator+(int daysToAdd) const
Definition calendar.cpp:239
bool operator<(const CalendarDate &other) const
Definition calendar.inl:488
ALIB_DLL CalendarDate operator--()
Definition calendar.cpp:274
CalendarDuration(lang::Initialization init=lang::Initialization::Default)
Definition calendar.inl:209
CalendarDuration(DateTime::Duration duration)
Definition calendar.inl:223
int Seconds
The number of seconds (not the total, hence 0-59) within the duration.
Definition calendar.inl:194
CalendarDuration(Ticks::Duration duration)
Definition calendar.inl:228
ALIB_DLL void FromNanoSeconds(int64_t nanos)
Definition calendar.cpp:179
int Hours
The number of hours (not the total, hence 0-23) within the duration.
Definition calendar.inl:188
int Nanoseconds
The number of nanoseconds (not the total, hence 0-999) within the duration.
Definition calendar.inl:203
int Minutes
The number of minutes (not the total, hence 0-59) within the duration.
Definition calendar.inl:191
void FromDuration(DateTime::Duration duration)
Definition calendar.inl:234
int Milliseconds
The number of milliseconds (not the total, hence 0-999) within the duration.
Definition calendar.inl:197
ALIB_DLL void Clear()
Sets all public values to 0.
Definition calendar.cpp:162
DateTime::Duration ToDateTimeDuration()
Definition calendar.inl:247
void FromDuration(Ticks::Duration duration)
Definition calendar.inl:241
int Microseconds
The number of microseconds (not the total, hence 0-999) within the duration.
Definition calendar.inl:200
int Days
The number of days within the duration.
Definition calendar.inl:185
#define ALIB_DLL
Definition alib.inl:503
#define ALIB_EXPORT
Definition alib.inl:497
@ Keep
Chooses not no clear existing data.
Initialization
Used, for example, with constructors that allow to suppress initialization of members.
Timezone
Denotes whether a time value represents local time or UTC.
@ Local
Denotes local time.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
time::DateTime DateTime
Type alias in namespace alib.
Definition datetime.inl:185
strings::util::CalendarDateTime CalendarDateTime
Type alias in namespace alib.
Definition calendar.inl:512
strings::util::CalendarDuration CalendarDuration
Type alias in namespace alib.
Definition calendar.inl:515
strings::util::CalendarDate CalendarDate
Type alias in namespace alib.
Definition calendar.inl:518
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2189
strings::TSubstring< character > Substring
Type alias in namespace alib.