ReFRACtor
FullPhysics::Time Class Reference

This is a simple time class. More...

#include <fp_time.h>

+ Inheritance diagram for FullPhysics::Time:
+ Collaboration diagram for FullPhysics::Time:

Public Member Functions

 Time ()
 Default constructor. More...
 
 Time (const boost::posix_time::ptime &t)
 Create from a boost posix time. More...
 
double frac_day_of_year () const
 Calculate the fractional day of the year. More...
 
double frac_year () const
 Calculate the fractional year. More...
 
double iet_time () const
 Give time in IDPS Epoch Time (IET) time, as double (epoch 1958-01-01) More...
 
 operator boost::posix_time::ptime () const
 Convert to a boost ptime. More...
 
Timeoperator+= (double T)
 Add given number of seconds to Time. More...
 
Timeoperator-= (double T)
 Subtract given number of seconds to Time. More...
 
double pgs_time () const
 Give time in PGS toolkit time, as a double (epoch 1993-01-01) More...
 
void print (std::ostream &os) const
 Print to stream. More...
 
std::string print_to_string () const
 Print to string. More...
 
std::string to_string () const
 Convert to CCSDS format. More...
 
double unix_time () const
 Give time in unix time, as a double (epoch 1970-01-01) More...
 

Static Public Member Functions

static Time parse_time (const std::string &Time_string)
 Parse CCSDS format time (e.g., "1996-07-03T04:13:57.987654Z") More...
 
static Time time_iet (double iet)
 Return time from given IDPS Epoch Time (IET) (epoch of 1958-01-01). More...
 
static Time time_pgs (double pgs)
 Return time from given PGS toolkit time (epoch of 1993-01-01). More...
 
static Time time_unix (double unix_time)
 Return time from given Unix time (epoch of 1970-01-01). More...
 

Detailed Description

This is a simple time class.

There are a few reasonable choices for expressing time information. We could use TAI, GPS, the PGS toolkit. Each of these time system can be related to the other by a constant, since the only difference is the Epoch that time is measure against.

For simplicity, we just use the standard unix time in seconds from January 1, 1970.

This class abstracts out the representation we use for time. We supply conversions to the specific time systems for use in the cases that a specific system is needed (e.g., calling a PGS toolkit routine).

We also supply methods for converting to and from a string representation of the time. We support the standard CCSDS format (e.g., "1996-07-03T04:13:57.987654Z").

Definition at line 29 of file fp_time.h.

Constructor & Destructor Documentation

◆ Time() [1/2]

FullPhysics::Time::Time ( )
inline

Default constructor.

Definition at line 40 of file fp_time.h.

◆ Time() [2/2]

Time::Time ( const boost::posix_time::ptime &  t)

Create from a boost posix time.

Definition at line 12 of file fp_time.cc.

Member Function Documentation

◆ frac_day_of_year()

double Time::frac_day_of_year ( ) const

Calculate the fractional day of the year.

This is the number of days, including the fractional part of the time of day, since midnight January 1 of the year.

Definition at line 37 of file fp_time.cc.

◆ frac_year()

double Time::frac_year ( ) const

Calculate the fractional year.

This is the year plus the fractional part of it.

Definition at line 49 of file fp_time.cc.

◆ iet_time()

double FullPhysics::Time::iet_time ( ) const
inline

Give time in IDPS Epoch Time (IET) time, as double (epoch 1958-01-01)

Definition at line 94 of file fp_time.h.

◆ operator boost::posix_time::ptime()

Time::operator boost::posix_time::ptime ( ) const

Convert to a boost ptime.

Definition at line 23 of file fp_time.cc.

◆ operator+=()

Time& FullPhysics::Time::operator+= ( double  T)
inline

Add given number of seconds to Time.

Definition at line 70 of file fp_time.h.

◆ operator-=()

Time& FullPhysics::Time::operator-= ( double  T)
inline

Subtract given number of seconds to Time.

Definition at line 76 of file fp_time.h.

◆ parse_time()

Time Time::parse_time ( const std::string &  Time_string)
static

Parse CCSDS format time (e.g., "1996-07-03T04:13:57.987654Z")

Definition at line 64 of file fp_time.cc.

◆ pgs_time()

double FullPhysics::Time::pgs_time ( ) const
inline

Give time in PGS toolkit time, as a double (epoch 1993-01-01)

Definition at line 88 of file fp_time.h.

◆ print()

void FullPhysics::Time::print ( std::ostream &  os) const
inline

Print to stream.

Definition at line 106 of file fp_time.h.

◆ print_to_string()

std::string FullPhysics::Printable< Time >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.

◆ time_iet()

static Time FullPhysics::Time::time_iet ( double  iet)
inlinestatic

Return time from given IDPS Epoch Time (IET) (epoch of 1958-01-01).

Definition at line 63 of file fp_time.h.

◆ time_pgs()

static Time FullPhysics::Time::time_pgs ( double  pgs)
inlinestatic

Return time from given PGS toolkit time (epoch of 1993-01-01).

Definition at line 56 of file fp_time.h.

◆ time_unix()

static Time FullPhysics::Time::time_unix ( double  unix_time)
inlinestatic

Return time from given Unix time (epoch of 1970-01-01).

Definition at line 49 of file fp_time.h.

◆ to_string()

std::string Time::to_string ( ) const

Convert to CCSDS format.

Definition at line 82 of file fp_time.cc.

◆ unix_time()

double FullPhysics::Time::unix_time ( ) const
inline

Give time in unix time, as a double (epoch 1970-01-01)

Definition at line 82 of file fp_time.h.


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

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:14