Rcpp Version 1.1.2
Loading...
Searching...
No Matches
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
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 32 of file Datetime.h.

Constructor & Destructor Documentation

◆ Datetime() [1/4]

Rcpp::Datetime::Datetime ( )
inline

Definition at line 34 of file Datetime.h.

References m_dt, and update_tm().

Referenced by operator!=, operator+, operator+, operator-, operator<, operator<<, operator<=, operator==, operator>, and operator>=.

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 Rcpp::as(), 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 41 of file Datetime.h.

References 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 Rcpp::as(), m_dt, and update_tm().

Here is the call graph for this function:

Member Function Documentation

◆ baseYear()

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

Definition at line 115 of file Datetime.h.

◆ format()

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

Definition at line 74 of file Datetime.h.

References m_dt, m_us, and Rcpp::tm.

Referenced by operator<<, and Rcpp::newDatetimeVector::operator<<.

◆ getDay()

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

Definition at line 53 of file Datetime.h.

References m_tm.

◆ getFractionalTimestamp()

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

Definition at line 47 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 52 of file Datetime.h.

References m_tm.

◆ getMicroSeconds()

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

Definition at line 49 of file Datetime.h.

References m_us.

◆ getMinutes()

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

Definition at line 51 of file Datetime.h.

References m_tm.

◆ getMonth()

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

Definition at line 54 of file Datetime.h.

References m_tm.

◆ getSeconds()

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

Definition at line 50 of file Datetime.h.

References m_tm.

◆ getWeekday()

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

Definition at line 56 of file Datetime.h.

References m_tm.

◆ getYear()

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

Definition at line 55 of file Datetime.h.

References m_tm.

◆ getYearday()

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

Definition at line 57 of file Datetime.h.

References m_tm.

◆ is_na()

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

Definition at line 70 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 72 of file Datetime.h.

References m_dt.

◆ update_tm()

void Rcpp::Datetime::update_tm ( )
inlineprivate

Definition at line 99 of file Datetime.h.

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

Referenced by Datetime(), Datetime(), Datetime(), and Datetime().

Here is the call graph for this function:

◆ operator!=

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

Definition at line 163 of file Datetime.h.

References Datetime(), and m_dt.

◆ operator+ [1/2]

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

Definition at line 137 of file Datetime.h.

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

◆ operator+ [2/2]

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

Definition at line 147 of file Datetime.h.

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

◆ operator-

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

Definition at line 157 of file Datetime.h.

References Datetime(), and m_dt.

◆ operator<

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

Definition at line 158 of file Datetime.h.

References Datetime(), and m_dt.

◆ operator<<

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

Definition at line 165 of file Datetime.h.

References Datetime(), and format().

◆ operator<=

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

Definition at line 162 of file Datetime.h.

References Datetime(), and m_dt.

◆ operator==

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

Definition at line 160 of file Datetime.h.

References Datetime(), and m_dt.

◆ operator>

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

Definition at line 159 of file Datetime.h.

References Datetime(), and m_dt.

◆ operator>=

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

Definition at line 161 of file Datetime.h.

References Datetime(), and m_dt.

Member Data Documentation

◆ m_dt

◆ m_tm

struct tm Rcpp::Datetime::m_tm
private

◆ m_us

int Rcpp::Datetime::m_us
private

Definition at line 96 of file Datetime.h.

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


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