ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | Public Methods | List of all members
CalendarDuration Class Reference

#include <calendar.hpp>

Class Description


This class represents a time span, measured in human units like days, hours, minutes and so on. Besides conversion from and to nanoseconds, conversions from and to objects of types DateTime::Duration and Ticks::Duration is supported.

Note
This class is part of module ALib System. While it is a pure utility class for types DateTime and Ticks found in module ALib Time, the class was located in module System to keep module Time lean and free from dependencies to module ALib Text and all its sub-dependencies.

Definition at line 214 of file calendar.hpp.

Public Fields

int Days
 
int Hours
 
int Microseconds
 
int Milliseconds
 
int Minutes
 
int Nanoseconds
 
int Seconds
 

Public Methods

 CalendarDuration (DateTime::Duration duration)
 
 CalendarDuration (Initialization init=Initialization::Perform)
 
 CalendarDuration (int64_t nanos)
 
 CalendarDuration (Ticks::Duration duration)
 
ALIB_API void Clear ()
 
void FromDuration (DateTime::Duration duration)
 
void FromDuration (Ticks::Duration duration)
 
ALIB_API void FromNanoSeconds (int64_t nanos)
 
DateTime::Duration ToDateTimeDuration ()
 
ALIB_API int64_t ToNanoSeconds ()
 
Ticks::Duration ToTicksDuration ()
 

Constructor & Destructor Documentation

◆ CalendarDuration() [1/4]


Constructs the object to represent a duration of 0. (Sets all public fields to 0.)

Parameters
initIf Initialization::Perform, Clear is invoked. Otherwise fields are not initialized. Defaults to Initialization::Perform.

Definition at line 244 of file calendar.hpp.

Here is the call graph for this function:

◆ CalendarDuration() [2/4]

CalendarDuration ( int64_t  nanos)
inline

Constructs the object using the given duration measured in nanoseconds. Invokes FromNanoSeconds.

Parameters
nanosThe duration to use for setting the public fields.

Definition at line 255 of file calendar.hpp.

Here is the call graph for this function:

◆ CalendarDuration() [3/4]

CalendarDuration ( DateTime::Duration  duration)
inline

Constructs the object using the given duration object. Invokes FromDuration.

Parameters
durationThe duration to use for setting the public fields.

Definition at line 265 of file calendar.hpp.

Here is the call graph for this function:

◆ CalendarDuration() [4/4]

CalendarDuration ( Ticks::Duration  duration)
inline

Constructs the object using the given duration object. Invokes FromDuration.

Parameters
durationThe duration to use for setting the public fields.

Definition at line 275 of file calendar.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ Clear()

void Clear ( )

Sets all public values to 0.

Definition at line 165 of file calendar.cpp.

◆ FromDuration() [1/2]

void FromDuration ( DateTime::Duration  duration)
inline

Sets the public fields to represent the given duration value. The state of the object will hereafter be the same as it was when constructed with the same parameter.

Parameters
durationThe duration to use for setting the public fields.

Definition at line 286 of file calendar.hpp.

Here is the call graph for this function:

◆ FromDuration() [2/2]

void FromDuration ( Ticks::Duration  duration)
inline

Sets the public fields to represent the given duration value. The state of the object will hereafter be the same as it was when constructed with the same parameter.

Parameters
durationThe duration to use for setting the public fields.

Definition at line 297 of file calendar.hpp.

Here is the call graph for this function:

◆ FromNanoSeconds()

void FromNanoSeconds ( int64_t  nanos)

Sets the public fields to represent the given duration value. The state of the object will hereafter be the same as it was when constructed with the same parameter.

Parameters
nanosThe duration to use for setting the public fields.

Definition at line 183 of file calendar.cpp.

Here is the call graph for this function:

◆ ToDateTimeDuration()

DateTime::Duration ToDateTimeDuration ( )
inline

Takes the current values of the public fields and returns a duration value compatible with class DateTime.

Returns
The duration represented by the public fields of this class.

Definition at line 307 of file calendar.hpp.

Here is the call graph for this function:

◆ ToNanoSeconds()

int64_t ToNanoSeconds ( )

Takes the current values of the public fields and returns the duration.

Returns
The duration represented by the public fields of this class in nanoseconds.

Definition at line 195 of file calendar.cpp.

◆ ToTicksDuration()

Ticks::Duration ToTicksDuration ( )
inline

Takes the current values of the public fields and returns a duration value compatible with class Ticks.

Returns
The duration represented by the public fields of this class.

Definition at line 317 of file calendar.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ Days

int Days

The number of days within the duration

Definition at line 218 of file calendar.hpp.

◆ Hours

int Hours

The number of hours (not the total, hence 0-23) within the duration.

Definition at line 221 of file calendar.hpp.

◆ Microseconds

int Microseconds

The number of microseconds (not the total, hence 0-999) within the duration.

Definition at line 233 of file calendar.hpp.

◆ Milliseconds

int Milliseconds

The number of milliseconds (not the total, hence 0-999) within the duration.

Definition at line 230 of file calendar.hpp.

◆ Minutes

int Minutes

The number of minutes (not the total, hence 0-59) within the duration.

Definition at line 224 of file calendar.hpp.

◆ Nanoseconds

int Nanoseconds

The number of nanoseconds (not the total, hence 0-999) within the duration.

Definition at line 236 of file calendar.hpp.

◆ Seconds

int Seconds

The number of seconds (not the total, hence 0-59) within the duration.

Definition at line 227 of file calendar.hpp.


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