DUDS
Distributed Update of Data from Something
duds::time::interstellar::Metricform Struct Reference

Holds Interstellar Time down to seconds in fields that increase by a power of 1000, three decimal digits each, up to a gigaseconds field. More...

#include <Metricform.hpp>

Public Member Functions

 Metricform ()=default
 Default constructor. More...
 
template<class Rep , class Period >
 Metricform (const std::chrono::duration< Rep, Period > &d)
 Constructs a Metricform with the duration contained in d truncated to seconds. More...
 
template<class Clock , class Duration >
 Metricform (const std::chrono::time_point< Clock, Duration > &t)
 Constructs a Metricform with the time contained in t truncated to seconds. More...
 
template<class Duration >
void setDuration (const Duration &d)
 Sets the stored time to be the same as the time given truncated to seconds. More...
 
template<class Time >
void setTime (const Time &d)
 
template<class Int >
void setToSeconds (Int t)
 Sets the stored time to be the same as the time given. More...
 

Public Attributes

unsigned int G: 32
 Gigaseconds field. More...
 
unsigned int k: 10
 Kiloseconds field. More...
 
unsigned int M: 10
 Megaseconds field. More...
 
unsigned int neg: 1
 The negative flag. More...
 
unsigned int s: 10
 Seconds field. More...
 

Detailed Description

Holds Interstellar Time down to seconds in fields that increase by a power of 1000, three decimal digits each, up to a gigaseconds field.

The size of these fields jumps by large bounds compared to common systems of time and date used on Earth, which may make this form less desirable for use than Hectoform, but its fields all use proper metric prefixes.

Author
Jeff Jackowski

Definition at line 23 of file Metricform.hpp.

Constructor & Destructor Documentation

◆ Metricform() [1/3]

duds::time::interstellar::Metricform::Metricform ( )
default

Default constructor.

◆ Metricform() [2/3]

template<class Rep , class Period >
duds::time::interstellar::Metricform::Metricform ( const std::chrono::duration< Rep, Period > &  d)
inline

Constructs a Metricform with the duration contained in d truncated to seconds.

Template Parameters
DurationA time duration class related to std::chrono::duration.
Parameters
dThe duration.

Definition at line 63 of file Metricform.hpp.

◆ Metricform() [3/3]

template<class Clock , class Duration >
duds::time::interstellar::Metricform::Metricform ( const std::chrono::time_point< Clock, Duration > &  t)
inline

Constructs a Metricform with the time contained in t truncated to seconds.

Template Parameters
ClockA clock class, such as FemtoClock.
Parameters
tThe time.

Definition at line 73 of file Metricform.hpp.

Member Function Documentation

◆ setDuration()

template<class Duration >
void duds::time::interstellar::Metricform::setDuration ( const Duration &  d)
inline

Sets the stored time to be the same as the time given truncated to seconds.

Template Parameters
DurationA time duration class related to std::chrono::duration.
Parameters
dThe duration.

Definition at line 107 of file Metricform.hpp.

Referenced by Metricform().

◆ setTime()

template<class Time >
void duds::time::interstellar::Metricform::setTime ( const Time &  d)
inline

Definition at line 113 of file Metricform.hpp.

Referenced by Metricform().

◆ setToSeconds()

template<class Int >
void duds::time::interstellar::Metricform::setToSeconds ( Int  t)
inline

Sets the stored time to be the same as the time given.

Template Parameters
IntAn integer type or something that acts like an integer.
Parameters
tThe time in seconds.

Definition at line 82 of file Metricform.hpp.

Referenced by setDuration(), and setTime().

Member Data Documentation

◆ G

unsigned int duds::time::interstellar::Metricform::G

Gigaseconds field.

One unit in regular old Earth time is: 31 years, 251 days, 13 hours, 21 minutes, and 28 seconds.

Definition at line 29 of file Metricform.hpp.

Referenced by duds::time::interstellar::operator<<(), and setToSeconds().

◆ k

unsigned int duds::time::interstellar::Metricform::k

Kiloseconds field.

One unit in regular old Earth time is: 16 minutes and 40 seconds.

Definition at line 41 of file Metricform.hpp.

Referenced by duds::time::interstellar::operator<<(), and setToSeconds().

◆ M

unsigned int duds::time::interstellar::Metricform::M

Megaseconds field.

One unit in regular old Earth time is: 11 days, 13 hours, 46 minutes, and 40 seconds.

Definition at line 35 of file Metricform.hpp.

Referenced by duds::time::interstellar::operator<<(), and setToSeconds().

◆ neg

unsigned int duds::time::interstellar::Metricform::neg

The negative flag.

It doesn't make sense to have every number in this struct be negative for a negative time, and integers cannot be negative zero, so this flag is used instead.

Definition at line 51 of file Metricform.hpp.

Referenced by duds::time::interstellar::operator<<(), and setToSeconds().

◆ s

unsigned int duds::time::interstellar::Metricform::s

Seconds field.

Definition at line 45 of file Metricform.hpp.

Referenced by duds::time::interstellar::operator<<(), and setToSeconds().


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