GEOS
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
geos::units::TimeFormatInfo Struct Reference

Stores information that is useful to duration strings. Based on the geos::units time constants. More...

#include <Units.hpp>

Public Member Functions

 TimeFormatInfo (double totalSeconds, int years, int days, int hours, int minutes, int seconds)
 Construct a TimeFormatInfo from raw data (which must be coherent) More...
 
string toString () const
 
string toUnfoldedString () const
 
string toSecondsString () const
 

Static Public Member Functions

static TimeFormatInfo fromSeconds (double const seconds)
 
template<typename DURATION >
static TimeFormatInfo fromDuration (DURATION duration)
 

Public Attributes

double const m_totalSeconds = 0.0
 Total time (including the decimal part) this instance represents in seconds.
 
int const m_years = 0
 Number of integral years to show.
 
int const m_days = 0
 Number of integral days to show.
 
int const m_hours = 0
 Number of integral hours to show.
 
int const m_minutes = 0
 Number of integral minutes to show.
 
int const m_seconds = 0
 Number of integral seconds to show.
 

Friends

std::ostream & operator<< (std::ostream &os, TimeFormatInfo const &ctx)
 Insert the string representation information in the provided stream.
 

Detailed Description

Stores information that is useful to duration strings. Based on the geos::units time constants.

Definition at line 215 of file Units.hpp.

Constructor & Destructor Documentation

◆ TimeFormatInfo()

geos::units::TimeFormatInfo::TimeFormatInfo ( double  totalSeconds,
int  years,
int  days,
int  hours,
int  minutes,
int  seconds 
)

Construct a TimeFormatInfo from raw data (which must be coherent)

Parameters
totalSecondsThe total time (including the decimal part) this instance represents in seconds
yearsNumber of integral years to show
daysNumber of integral days to show
hoursNumber of integral hours to show
minutesNumber of integral minutes to show
secondsNumber of integral seconds to show

Member Function Documentation

◆ fromDuration()

template<typename DURATION >
TimeFormatInfo geos::units::TimeFormatInfo::fromDuration ( DURATION  duration)
static
Returns
A TimeFormatInfo constructed from a standard typed duration value
Parameters
durationthe duration to represents, in SystemClock::duration type (more types can be added by adding std::chrono::duration template specialisations).

Definition at line 274 of file Units.hpp.

◆ fromSeconds()

static TimeFormatInfo geos::units::TimeFormatInfo::fromSeconds ( double const  seconds)
static
Returns
A TimeFormatInfo constructed from the seconds to represent
Parameters
secondsthe total time to represents in seconds (including the decimal part)

◆ toSecondsString()

string geos::units::TimeFormatInfo::toSecondsString ( ) const
Returns
a precise string representation of this structure (decimal seconds).

◆ toString()

string geos::units::TimeFormatInfo::toString ( ) const
Returns
a comprehensive string representation of this structure.

◆ toUnfoldedString()

string geos::units::TimeFormatInfo::toUnfoldedString ( ) const
Returns
a user friendly string representation of this structure (YDHMS format, without subsecond details).

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