tempoch-cpp
Header-only C++ wrapper for tempoch
Loading...
Searching...
No Matches
tempoch::UTC Struct Reference

UTC date-time breakdown. More...

#include <tempoch/time.hpp>

Public Member Functions

 UTC ()
 Default constructor: J2000 epoch noon-like civil representation.
 
 UTC (int32_t y, uint8_t mo, uint8_t d, uint8_t h=0, uint8_t mi=0, uint8_t s=0, uint32_t ns=0)
 Construct from civil UTC components.
 
tempoch_utc_t to_c () const
 Convert to the C FFI struct.
 

Static Public Member Functions

static UTC from_c (const tempoch_utc_t &c)
 Create from the C FFI struct.
 

Public Attributes

int32_t year
 Gregorian year (astronomical year numbering).
 
uint8_t month
 Month in range [1, 12].
 
uint8_t day
 Day of month in range [1, 31].
 
uint8_t hour
 Hour in range [0, 23].
 
uint8_t minute
 Minute in range [0, 59].
 
uint8_t second
 Second in range [0, 60], leap second aware.
 
uint32_t nanosecond
 Nanosecond component in range [0, 999,999,999].
 

Detailed Description

UTC date-time breakdown.

A simple value type mirroring the C tempoch_utc_t struct.

tempoch::UTC noon(2000, 1, 1, 12, 0, 0);
static JulianDate from_utc(const UTC &utc)
Create from a UTC date-time.
Definition time.hpp:99
UTC date-time breakdown.
Definition time.hpp:28
Examples
time_example.cpp.

Definition at line 28 of file time.hpp.

Constructor & Destructor Documentation

◆ UTC() [1/2]

tempoch::UTC::UTC ( )
inline

Default constructor: J2000 epoch noon-like civil representation.

Definition at line 45 of file time.hpp.

Referenced by from_c().

◆ UTC() [2/2]

tempoch::UTC::UTC ( int32_t  y,
uint8_t  mo,
uint8_t  d,
uint8_t  h = 0,
uint8_t  mi = 0,
uint8_t  s = 0,
uint32_t  ns = 0 
)
inline

Construct from civil UTC components.

Parameters
yYear.
moMonth [1, 12].
dDay [1, 31].
hHour [0, 23].
miMinute [0, 59].
sSecond [0, 60].
nsNanoseconds [0, 999,999,999].

Definition at line 57 of file time.hpp.

Member Function Documentation

◆ from_c()

static UTC tempoch::UTC::from_c ( const tempoch_utc_t &  c)
inlinestatic

Create from the C FFI struct.

Definition at line 67 of file time.hpp.

References UTC().

Referenced by tempoch::JulianDate::to_utc(), and tempoch::MJD::to_utc().

◆ to_c()

tempoch_utc_t tempoch::UTC::to_c ( ) const
inline

Convert to the C FFI struct.

Definition at line 62 of file time.hpp.

References day, hour, minute, month, nanosecond, second, and year.

Referenced by tempoch::JulianDate::from_utc(), and tempoch::MJD::from_utc().

Member Data Documentation

◆ day

uint8_t tempoch::UTC::day

Day of month in range [1, 31].

Examples
time_example.cpp.

Definition at line 34 of file time.hpp.

Referenced by main(), and to_c().

◆ hour

uint8_t tempoch::UTC::hour

Hour in range [0, 23].

Examples
time_example.cpp.

Definition at line 36 of file time.hpp.

Referenced by main(), and to_c().

◆ minute

uint8_t tempoch::UTC::minute

Minute in range [0, 59].

Examples
time_example.cpp.

Definition at line 38 of file time.hpp.

Referenced by main(), and to_c().

◆ month

uint8_t tempoch::UTC::month

Month in range [1, 12].

Examples
time_example.cpp.

Definition at line 32 of file time.hpp.

Referenced by main(), and to_c().

◆ nanosecond

uint32_t tempoch::UTC::nanosecond

Nanosecond component in range [0, 999,999,999].

Definition at line 42 of file time.hpp.

Referenced by to_c().

◆ second

uint8_t tempoch::UTC::second

Second in range [0, 60], leap second aware.

Examples
time_example.cpp.

Definition at line 40 of file time.hpp.

Referenced by main(), and to_c().

◆ year

int32_t tempoch::UTC::year

Gregorian year (astronomical year numbering).

Examples
time_example.cpp.

Definition at line 30 of file time.hpp.

Referenced by main(), and to_c().


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