Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::time_point_sec Class Reference

#include <time.hpp>

Public Member Functions

constexpr time_point_sec ()
 
constexpr time_point_sec (uint32_t seconds)
 
constexpr time_point_sec (const time_point &t)
 
constexpr operator time_point () const
 
constexpr uint32_t sec_since_epoch () const
 
constexpr time_point_sec operator= (const fc::time_point &t)
 
constexpr time_point_secoperator+= (uint32_t m)
 
constexpr time_point_secoperator+= (microseconds m)
 
constexpr time_point_secoperator-= (uint32_t m)
 
constexpr time_point_secoperator-= (microseconds m)
 
constexpr time_point_sec operator+ (uint32_t offset) const
 
constexpr time_point_sec operator- (uint32_t offset) const
 
fc::string to_non_delimited_iso_string () const
 
fc::string to_iso_string () const
 
 operator fc::string () const
 

Static Public Member Functions

static constexpr time_point_sec maximum ()
 
static constexpr time_point_sec min ()
 
static time_point_sec from_iso_string (const fc::string &s)
 

Friends

constexpr friend bool operator< (const time_point_sec &a, const time_point_sec &b)
 
constexpr friend bool operator> (const time_point_sec &a, const time_point_sec &b)
 
constexpr friend bool operator<= (const time_point_sec &a, const time_point_sec &b)
 
constexpr friend bool operator>= (const time_point_sec &a, const time_point_sec &b)
 
constexpr friend bool operator== (const time_point_sec &a, const time_point_sec &b)
 
constexpr friend bool operator!= (const time_point_sec &a, const time_point_sec &b)
 
constexpr time_point operator+ (const time_point_sec &t, const microseconds &m)
 
constexpr time_point operator- (const time_point_sec &t, const microseconds &m)
 
constexpr microseconds operator- (const time_point_sec &t, const time_point_sec &m)
 
constexpr microseconds operator- (const time_point &t, const time_point_sec &m)
 

Detailed Description

A lower resolution time_point accurate only to seconds from 1970

Definition at line 72 of file time.hpp.

Constructor & Destructor Documentation

◆ time_point_sec() [1/3]

fc::time_point_sec::time_point_sec ( )
inlineconstexpr

Definition at line 75 of file time.hpp.

76 :utc_seconds(0){}
Here is the caller graph for this function:

◆ time_point_sec() [2/3]

fc::time_point_sec::time_point_sec ( uint32_t seconds)
inlineexplicitconstexpr

Definition at line 78 of file time.hpp.

79 :utc_seconds(seconds){}

◆ time_point_sec() [3/3]

fc::time_point_sec::time_point_sec ( const time_point & t)
inlineconstexpr

Definition at line 81 of file time.hpp.

82 :utc_seconds( t.time_since_epoch().count() / 1000000ll ){}

Member Function Documentation

◆ from_iso_string()

time_point_sec fc::time_point_sec::from_iso_string ( const fc::string & s)
static

Definition at line 39 of file time.cpp.

40 { try {
41 static boost::posix_time::ptime epoch = boost::posix_time::from_time_t( 0 );
42 boost::posix_time::ptime pt;
43 if( s.size() >= 5 && s.at( 4 ) == '-' ) // http://en.wikipedia.org/wiki/ISO_8601
44 pt = boost::date_time::parse_delimited_time<boost::posix_time::ptime>( s, 'T' );
45 else
46 pt = boost::posix_time::from_iso_string( s );
47 return fc::time_point_sec( (pt - epoch).total_seconds() );
48 } FC_RETHROW_EXCEPTIONS( warn, "unable to convert ISO-formatted string to fc::time_point_sec" ) }
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
char * s
Here is the caller graph for this function:

◆ maximum()

static constexpr time_point_sec fc::time_point_sec::maximum ( )
inlinestaticconstexpr

Definition at line 84 of file time.hpp.

84{ return time_point_sec(0xffffffff); }
constexpr time_point_sec()
Definition time.hpp:75
Here is the call graph for this function:

◆ min()

static constexpr time_point_sec fc::time_point_sec::min ( )
inlinestaticconstexpr

Definition at line 85 of file time.hpp.

85{ return time_point_sec(0); }
Here is the call graph for this function:

◆ operator fc::string()

fc::time_point_sec::operator fc::string ( ) const

Definition at line 34 of file time.cpp.

35 {
36 return this->to_iso_string();
37 }
fc::string to_iso_string() const
Definition time.cpp:28

◆ operator time_point()

fc::time_point_sec::operator time_point ( ) const
inlineconstexpr

Definition at line 87 of file time.hpp.

87{ return time_point( fc::seconds( utc_seconds) ); }
constexpr microseconds seconds(int64_t s)
Definition time.hpp:32
Here is the call graph for this function:

◆ operator+()

time_point_sec fc::time_point_sec::operator+ ( uint32_t offset) const
inlineconstexpr

Definition at line 105 of file time.hpp.

105{ return time_point_sec(utc_seconds + offset); }
Here is the call graph for this function:

◆ operator+=() [1/2]

time_point_sec & fc::time_point_sec::operator+= ( microseconds m)
inlineconstexpr

Definition at line 102 of file time.hpp.

102{ utc_seconds+=m.to_seconds(); return *this; }
Here is the call graph for this function:

◆ operator+=() [2/2]

time_point_sec & fc::time_point_sec::operator+= ( uint32_t m)
inlineconstexpr

Definition at line 101 of file time.hpp.

101{ utc_seconds+=m; return *this; }

◆ operator-()

time_point_sec fc::time_point_sec::operator- ( uint32_t offset) const
inlineconstexpr

Definition at line 106 of file time.hpp.

106{ return time_point_sec(utc_seconds - offset); }
Here is the call graph for this function:

◆ operator-=() [1/2]

time_point_sec & fc::time_point_sec::operator-= ( microseconds m)
inlineconstexpr

Definition at line 104 of file time.hpp.

104{ utc_seconds-=m.to_seconds(); return *this; }
Here is the call graph for this function:

◆ operator-=() [2/2]

time_point_sec & fc::time_point_sec::operator-= ( uint32_t m)
inlineconstexpr

Definition at line 103 of file time.hpp.

103{ utc_seconds-=m; return *this; }

◆ operator=()

time_point_sec fc::time_point_sec::operator= ( const fc::time_point & t)
inlineconstexpr

Definition at line 90 of file time.hpp.

91 {
92 utc_seconds = t.time_since_epoch().count() / 1000000ll;
93 return *this;
94 }
constexpr int64_t count() const
Definition time.hpp:26
constexpr const microseconds & time_since_epoch() const
Definition time.hpp:52
Here is the call graph for this function:

◆ sec_since_epoch()

uint32_t fc::time_point_sec::sec_since_epoch ( ) const
inlineconstexpr

Definition at line 88 of file time.hpp.

88{ return utc_seconds; }
Here is the caller graph for this function:

◆ to_iso_string()

fc::string fc::time_point_sec::to_iso_string ( ) const

Definition at line 28 of file time.cpp.

29 {
30 const auto ptime = boost::posix_time::from_time_t( time_t( sec_since_epoch() ) );
31 return boost::posix_time::to_iso_extended_string( ptime );
32 }
constexpr uint32_t sec_since_epoch() const
Definition time.hpp:88
Here is the call graph for this function:

◆ to_non_delimited_iso_string()

fc::string fc::time_point_sec::to_non_delimited_iso_string ( ) const

Definition at line 22 of file time.cpp.

23 {
24 const auto ptime = boost::posix_time::from_time_t( time_t( sec_since_epoch() ) );
25 return boost::posix_time::to_iso_string( ptime );
26 }
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

friend bool operator!= ( const time_point_sec & a,
const time_point_sec & b )
friend

Definition at line 100 of file time.hpp.

100{ return a.utc_seconds != b.utc_seconds; }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

◆ operator+

time_point operator+ ( const time_point_sec & t,
const microseconds & m )
friend

Definition at line 108 of file time.hpp.

108{ return time_point(t) + m; }

◆ operator- [1/3]

microseconds operator- ( const time_point & t,
const time_point_sec & m )
friend

Definition at line 111 of file time.hpp.

111{ return time_point(t) - time_point(m); }

◆ operator- [2/3]

time_point operator- ( const time_point_sec & t,
const microseconds & m )
friend

Definition at line 109 of file time.hpp.

109{ return time_point(t) - m; }

◆ operator- [3/3]

microseconds operator- ( const time_point_sec & t,
const time_point_sec & m )
friend

Definition at line 110 of file time.hpp.

110{ return time_point(t) - time_point(m); }

◆ operator<

friend bool operator< ( const time_point_sec & a,
const time_point_sec & b )
friend

Definition at line 95 of file time.hpp.

95{ return a.utc_seconds < b.utc_seconds; }

◆ operator<=

friend bool operator<= ( const time_point_sec & a,
const time_point_sec & b )
friend

Definition at line 97 of file time.hpp.

97{ return a.utc_seconds <= b.utc_seconds; }

◆ operator==

friend bool operator== ( const time_point_sec & a,
const time_point_sec & b )
friend

Definition at line 99 of file time.hpp.

99{ return a.utc_seconds == b.utc_seconds; }

◆ operator>

friend bool operator> ( const time_point_sec & a,
const time_point_sec & b )
friend

Definition at line 96 of file time.hpp.

96{ return a.utc_seconds > b.utc_seconds; }

◆ operator>=

friend bool operator>= ( const time_point_sec & a,
const time_point_sec & b )
friend

Definition at line 98 of file time.hpp.

98{ return a.utc_seconds >= b.utc_seconds; }

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