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

UTC date-time breakdown. More...

#include <tempoch/civil_time.hpp>

Public Member Functions

 CivilTime ()
 Default constructor: J2000 epoch noon-like civil representation.
 
 CivilTime (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 CivilTime 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 [1, 12].
 
uint8_t day
 Day of month [1, 31].
 
uint8_t hour
 Hour [0, 23].
 
uint8_t minute
 Minute [0, 59].
 
uint8_t second
 Second [0, 60] (60 only during a positive leap second).
 
uint32_t nanosecond
 Nanosecond [0, 999 999 999].
 

Detailed Description

UTC date-time breakdown.

A simple value type mirroring the C tempoch_utc_t struct.

tempoch::CivilTime noon(2000, 1, 1, 12, 0, 0);
static Time from_civil(const CivilTime &civil)
constexpr tempoch_scale_tag_t scale_tag_v
UTC date-time breakdown.

Definition at line 28 of file civil_time.hpp.

Constructor & Destructor Documentation

◆ CivilTime() [1/2]

tempoch::CivilTime::CivilTime ( )
inline

Default constructor: J2000 epoch noon-like civil representation.

Definition at line 38 of file civil_time.hpp.

Referenced by from_c().

◆ CivilTime() [2/2]

tempoch::CivilTime::CivilTime ( 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.

Definition at line 43 of file civil_time.hpp.

Member Function Documentation

◆ from_c()

static CivilTime tempoch::CivilTime::from_c ( const tempoch_utc_t c)
inlinestatic

Create from the C FFI struct.

Definition at line 51 of file civil_time.hpp.

References CivilTime().

Referenced by tempoch::detail::time_to_civil().

◆ to_c()

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

Convert to the C FFI struct.

Definition at line 48 of file civil_time.hpp.

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

Member Data Documentation

◆ day

uint8_t tempoch::CivilTime::day

Day of month [1, 31].

Definition at line 31 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().

◆ hour

uint8_t tempoch::CivilTime::hour

Hour [0, 23].

Definition at line 32 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().

◆ minute

uint8_t tempoch::CivilTime::minute

Minute [0, 59].

Definition at line 33 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().

◆ month

uint8_t tempoch::CivilTime::month

Month [1, 12].

Definition at line 30 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().

◆ nanosecond

uint32_t tempoch::CivilTime::nanosecond

Nanosecond [0, 999 999 999].

Definition at line 35 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().

◆ second

uint8_t tempoch::CivilTime::second

Second [0, 60] (60 only during a positive leap second).

Definition at line 34 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().

◆ year

int32_t tempoch::CivilTime::year

Gregorian year (astronomical year numbering).

Definition at line 29 of file civil_time.hpp.

Referenced by tempoch::operator<<(), and to_c().


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