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

A first take at implementing an early definition of Interstellar Time. More...

Classes

struct  FemtoClock
 Provides Interstellar Time in Femtoseconds. More...
 
struct  Hectoform
 Holds Interstellar Time down to seconds in fields that increase by a power of 100, two decimal digits each, up to a 1e10 seconds field. More...
 
struct  Metricform
 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...
 
struct  MilliClock
 Provides Interstellar Time in Milliseconds. More...
 
struct  NanoClock
 Provides Interstellar Time in Nanoseconds. More...
 
struct  SecondClock
 Provides Interstellar Time in seconds. More...
 
class  TimePoint
 An extention to the C++ std::chrono::time_point template to make time points easier to work with. More...
 

Typedefs

typedef std::chrono::duration< int128_t, std::femto > Femtoseconds
 Stores a duration in femtoseconds. More...
 
typedef FemtoClock::time_point FemtoTime
 A point in time in Interstellar Time stored in Femtoseconds. More...
 
typedef std::chrono::duration< std::int64_t, std::milli > Milliseconds
 Stores a duration in milliseconds. More...
 
typedef MilliClock::time_point MilliTime
 A point in time in Interstellar Time stored in Milliseconds. More...
 
typedef std::chrono::duration< std::uint64_t, std::nano > Nanoseconds
 Stores a duration in nanoseconds. More...
 
typedef NanoClock::time_point NanoTime
 A point in time in Interstellar Time stored in Nanoseconds. More...
 
typedef std::chrono::duration< std::int64_t > Seconds
 Stores a duration in seconds. More...
 
typedef SecondClock::time_point SecondTime
 A point in time in Interstellar Time stored in Seconds. More...
 

Functions

template<class ISTime >
boost::posix_time::ptime EarthTimeTAI (const ISTime &t)
 
const duds::data::int128_t OneE12 (1000000000000L)
 
const duds::data::int128_t OneE15 (1000000000000000L)
 
const duds::data::int128_t OneE6 (1000000L)
 
std::ostream & operator<< (std::ostream &os, const Metricform &m)
 Writes the Metricform time in its Human readable format in plain text. More...
 
std::ostream & operator<< (std::ostream &os, const Hectoform &h)
 Writes the Hectoform time in its Human readable format in plain text. More...
 

Variables

const int128_t OneE12
 1e12 in a 128-bit integer. More...
 
const int128_t OneE15
 1e15 in a 128-bit integer. More...
 
const int128_t OneE6
 1e6 in a 128-bit integer. More...
 

Detailed Description

A first take at implementing an early definition of Interstellar Time.

Bug:
Fix named types!

The time storage classes, TimeFemtos, TimeNanos, TimeMillis, and TimeSeconds, all use different uints and have different ranges. All but TimeFemtos use 64-bit integers, and all but TimeNanos are signed. Assignment, basic arithmetic, and comparison operators are defined for all of these classes, and between the classes. When used between two classes, a conversion is first done so the operation is performed on the same units. The conversions are done using integer math and no range checking is performed, so be careful when using these operations. I'm not entirely happy with them.

Typedef Documentation

◆ Femtoseconds

typedef std::chrono::duration<int128_t, std::femto> duds::time::interstellar::Femtoseconds

Stores a duration in femtoseconds.

The range of the 128-bit number is about 1.701e23 seconds, or about 5.39 quadrillion Earth years, both positive and negative.

Note
Seralization support is in Serialize.hpp. If needed, Serialize.hpp should be included instead of Interstellar.hpp.
Author
Jeff Jackowski

Definition at line 126 of file Interstellar.hpp.

◆ FemtoTime

A point in time in Interstellar Time stored in Femtoseconds.

Time zero is defined as the very begining of the Earth year 1972, Gregorian calendar, according to TAI, minus 31536000 seconds (two non-leap years without leap seconds). The range of 5.39 quadrillion Earth years before and after time zero should allow this type to represent any time during the Stelliferous Era. This is a requirement for using the name Interstellar Time.

Note
Seralization support is in Serialize.hpp. If needed, Serialize.hpp should be included instead of Interstellar.hpp.

Definition at line 160 of file Interstellar.hpp.

◆ Milliseconds

typedef std::chrono::duration<std::int64_t, std::milli> duds::time::interstellar::Milliseconds

Stores a duration in milliseconds.

The range of the 64-bit number is about 9.223e15 seconds, or about 292 million Earth years, both positive and negative. This should be useful for many long-running applications where a 128-bit integer is considered burdensome.

Author
Jeff Jackowski

Definition at line 169 of file Interstellar.hpp.

◆ MilliTime

A point in time in Interstellar Time stored in Milliseconds.

Note
Seralization support is in Serialize.hpp. If needed, Serialize.hpp should be included instead of Interstellar.hpp.

Definition at line 195 of file Interstellar.hpp.

◆ Nanoseconds

typedef std::chrono::duration<std::uint64_t, std::nano> duds::time::interstellar::Nanoseconds

Stores a duration in nanoseconds.

The range of the 64-bit number is about 1.844e10 seconds, or about 584.5 Earth years, positive only. This should be useful for applications needing better than millisecond resolution where a 128-bit integer is considered burdensome.

Todo:
Maybe this should be signed.
Author
Jeff Jackowski

Definition at line 207 of file Interstellar.hpp.

◆ NanoTime

A point in time in Interstellar Time stored in Nanoseconds.

Note
Seralization support is in Serialize.hpp. If needed, Serialize.hpp should be included instead of Interstellar.hpp.

Definition at line 233 of file Interstellar.hpp.

◆ Seconds

typedef std::chrono::duration<std::int64_t> duds::time::interstellar::Seconds

Stores a duration in seconds.

The range of the 64-bit number is about 9.223e18 seconds, or about 292 billion Earth years, both positive and negative. This should be useful for many long-running applications where a 128-bit integer is considered burdensome and high resolution is not required.

Author
Jeff Jackowski

Definition at line 243 of file Interstellar.hpp.

◆ SecondTime

A point in time in Interstellar Time stored in Seconds.

Note
Seralization support is in Serialize.hpp. If needed, Serialize.hpp should be included instead of Interstellar.hpp.

Definition at line 270 of file Interstellar.hpp.

Function Documentation

◆ EarthTimeTAI()

template<class ISTime >
boost::posix_time::ptime duds::time::interstellar::EarthTimeTAI ( const ISTime &  t)

Definition at line 279 of file Interstellar.hpp.

◆ OneE12()

const duds::data::int128_t duds::time::interstellar::OneE12 ( 1000000000000L  )

◆ OneE15()

const duds::data::int128_t duds::time::interstellar::OneE15 ( 1000000000000000L  )

◆ OneE6()

const duds::data::int128_t duds::time::interstellar::OneE6 ( 1000000L  )

◆ operator<<() [1/2]

std::ostream & duds::time::interstellar::operator<< ( std::ostream &  os,
const Metricform m 
)

Writes the Metricform time in its Human readable format in plain text.

Author
Jeff Jackowski

Definition at line 17 of file Interstellar.cpp.

◆ operator<<() [2/2]

std::ostream & duds::time::interstellar::operator<< ( std::ostream &  os,
const Hectoform h 
)

Writes the Hectoform time in its Human readable format in plain text.

Author
Jeff Jackowski

Definition at line 28 of file Interstellar.cpp.

Referenced by duds::time::interstellar::Metricform::setTime(), and duds::time::interstellar::Hectoform::setTime().

Variable Documentation

◆ OneE12

const int128_t duds::time::interstellar::OneE12

1e12 in a 128-bit integer.

Referenced by operator<<().

◆ OneE15

const int128_t duds::time::interstellar::OneE15

1e15 in a 128-bit integer.

Referenced by operator<<().

◆ OneE6

const int128_t duds::time::interstellar::OneE6

1e6 in a 128-bit integer.

Referenced by operator<<().