GEOSX
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
 

Static Public Member Functions

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

Public Attributes

double m_totalSeconds = 0.0
 Total time (including the decimal part) this instance represents in seconds.
 
int m_years = 0
 Number of integral years to show.
 
int m_days = 0
 Number of integral days to show.
 
int m_hours = 0
 Number of integral hours to show.
 
int m_minutes = 0
 Number of integral minutes to show.
 
int 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 175 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 >
static 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).

◆ 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)

◆ toString()

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

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