Rcpp Version 1.0.9
Rcpp::Datetime Class Reference

#include <Datetime.h>

Public Member Functions

 Datetime ()
 
 Datetime (SEXP s)
 
 Datetime (const double &dt)
 
 Datetime (const std::string &s, const std::string &fmt="%Y-%m-%d %H:%M:%OS")
 
double getFractionalTimestamp (void) const
 
int getMicroSeconds () const
 
int getSeconds () const
 
int getMinutes () const
 
int getHours () const
 
int getDay () const
 
int getMonth () const
 
int getYear () const
 
int getWeekday () const
 
int getYearday () const
 
int is_na () const
 
 operator double () const
 
std::string format (const char *fmt="%Y-%m-%d %H:%M:%S") const
 

Private Member Functions

void update_tm ()
 

Static Private Member Functions

static unsigned int baseYear ()
 

Private Attributes

double m_dt
 
struct tm m_tm
 
unsigned int m_us
 

Friends

Datetime operator+ (const Datetime &dt, double offset)
 
Datetime operator+ (const Datetime &dt, int offset)
 
double operator- (const Datetime &dt1, const Datetime &dt2)
 
bool operator< (const Datetime &dt1, const Datetime &dt2)
 
bool operator> (const Datetime &dt1, const Datetime &dt2)
 
bool operator== (const Datetime &dt1, const Datetime &dt2)
 
bool operator>= (const Datetime &dt1, const Datetime &dt2)
 
bool operator<= (const Datetime &dt1, const Datetime &dt2)
 
bool operator!= (const Datetime &dt1, const Datetime &dt2)
 
std::ostream & operator<< (std::ostream &s, const Datetime d)
 

Detailed Description

Definition at line 33 of file Datetime.h.

Constructor & Destructor Documentation

◆ Datetime() [1/4]

Rcpp::Datetime::Datetime ( )
inline

Definition at line 35 of file Datetime.h.

References m_dt, and update_tm().

Here is the call graph for this function:

◆ Datetime() [2/4]

Rcpp::Datetime::Datetime ( SEXP  s)
inline

Definition at line 25 of file Datetime.h.

References m_dt, and update_tm().

Here is the call graph for this function:

◆ Datetime() [3/4]

Rcpp::Datetime::Datetime ( const double &  dt)
inline

Definition at line 42 of file Datetime.h.

References R::dt(), m_dt, and update_tm().

Here is the call graph for this function:

◆ Datetime() [4/4]

Rcpp::Datetime::Datetime ( const std::string &  s,
const std::string &  fmt = "%Y-%m-%d %H:%M:%OS" 
)
inline

Definition at line 30 of file Datetime.h.

References m_dt, and update_tm().

Here is the call graph for this function:

Member Function Documentation

◆ baseYear()

static unsigned int Rcpp::Datetime::baseYear ( )
inlinestaticprivate

Definition at line 116 of file Datetime.h.

◆ format()

std::string Rcpp::Datetime::format ( const char *  fmt = "%Y-%m-%d %H:%M:%S") const
inline

Definition at line 75 of file Datetime.h.

References m_dt, m_us, and Rcpp::tm.

◆ getDay()

int Rcpp::Datetime::getDay ( ) const
inline

Definition at line 54 of file Datetime.h.

References m_tm.

◆ getFractionalTimestamp()

double Rcpp::Datetime::getFractionalTimestamp ( void  ) const
inline

Definition at line 48 of file Datetime.h.

References m_dt.

Referenced by Rcpp::internal::caster< Rcpp::Datetime, double >(), and Rcpp::wrap< Datetime >().

◆ getHours()

int Rcpp::Datetime::getHours ( ) const
inline

Definition at line 53 of file Datetime.h.

References m_tm.

◆ getMicroSeconds()

int Rcpp::Datetime::getMicroSeconds ( ) const
inline

Definition at line 50 of file Datetime.h.

References m_us.

◆ getMinutes()

int Rcpp::Datetime::getMinutes ( ) const
inline

Definition at line 52 of file Datetime.h.

References m_tm.

◆ getMonth()

int Rcpp::Datetime::getMonth ( ) const
inline

Definition at line 55 of file Datetime.h.

References m_tm.

◆ getSeconds()

int Rcpp::Datetime::getSeconds ( ) const
inline

Definition at line 51 of file Datetime.h.

References m_tm.

◆ getWeekday()

int Rcpp::Datetime::getWeekday ( ) const
inline

Definition at line 57 of file Datetime.h.

References m_tm.

◆ getYear()

int Rcpp::Datetime::getYear ( ) const
inline

Definition at line 56 of file Datetime.h.

References m_tm.

◆ getYearday()

int Rcpp::Datetime::getYearday ( ) const
inline

Definition at line 58 of file Datetime.h.

References m_tm.

◆ is_na()

int Rcpp::Datetime::is_na ( ) const
inline

Definition at line 71 of file Datetime.h.

References Rcpp::traits::is_na< REALSXP >(), and m_dt.

Here is the call graph for this function:

◆ operator double()

Rcpp::Datetime::operator double ( ) const
inline

Definition at line 73 of file Datetime.h.

References m_dt.

◆ update_tm()

void Rcpp::Datetime::update_tm ( )
inlineprivate

Definition at line 100 of file Datetime.h.

References R::dt(), Rcpp::gmtime_(), m_dt, m_tm, and m_us.

Referenced by Datetime().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 164 of file Datetime.h.

◆ operator+ [1/2]

Datetime operator+ ( const Datetime dt,
double  offset 
)
friend

Definition at line 138 of file Datetime.h.

◆ operator+ [2/2]

Datetime operator+ ( const Datetime dt,
int  offset 
)
friend

Definition at line 148 of file Datetime.h.

◆ operator-

double operator- ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 158 of file Datetime.h.

◆ operator<

bool operator< ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 159 of file Datetime.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const Datetime  d 
)
friend

Definition at line 166 of file Datetime.h.

◆ operator<=

bool operator<= ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 163 of file Datetime.h.

◆ operator==

bool operator== ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 161 of file Datetime.h.

◆ operator>

bool operator> ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 160 of file Datetime.h.

◆ operator>=

bool operator>= ( const Datetime dt1,
const Datetime dt2 
)
friend

Definition at line 162 of file Datetime.h.

Member Data Documentation

◆ m_dt

double Rcpp::Datetime::m_dt
private

Definition at line 95 of file Datetime.h.

Referenced by Datetime(), format(), getFractionalTimestamp(), is_na(), operator double(), and update_tm().

◆ m_tm

struct tm Rcpp::Datetime::m_tm
private

◆ m_us

unsigned int Rcpp::Datetime::m_us
private

Definition at line 97 of file Datetime.h.

Referenced by format(), getMicroSeconds(), and update_tm().


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