Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::block_timestamp< IntervalMs, EpochMs > Class Template Reference

#include <block_timestamp.hpp>

Public Member Functions

 block_timestamp (uint32_t s=0)
 
 block_timestamp (const fc::time_point &t)
 
 block_timestamp (const fc::time_point_sec &t)
 
block_timestamp next () const
 
fc::time_point to_time_point () const
 
 operator fc::time_point () const
 
void operator= (const fc::time_point &t)
 
bool operator> (const block_timestamp &t) const
 
bool operator>= (const block_timestamp &t) const
 
bool operator< (const block_timestamp &t) const
 
bool operator<= (const block_timestamp &t) const
 
bool operator== (const block_timestamp &t) const
 
bool operator!= (const block_timestamp &t) const
 

Static Public Member Functions

static block_timestamp maximum ()
 
static block_timestamp min ()
 

Public Attributes

uint32_t slot
 

Detailed Description

template<uint16_t IntervalMs, uint64_t EpochMs>
class sysio::chain::block_timestamp< IntervalMs, EpochMs >

This class is used in the block headers to represent the block time It is a parameterised class that takes an Epoch in milliseconds and and an interval in milliseconds and computes the number of slots.

Definition at line 18 of file block_timestamp.hpp.

Constructor & Destructor Documentation

◆ block_timestamp() [1/3]

template<uint16_t IntervalMs, uint64_t EpochMs>
sysio::chain::block_timestamp< IntervalMs, EpochMs >::block_timestamp ( uint32_t s = 0)
inlineexplicit

Definition at line 20 of file block_timestamp.hpp.

Here is the caller graph for this function:

◆ block_timestamp() [2/3]

template<uint16_t IntervalMs, uint64_t EpochMs>
sysio::chain::block_timestamp< IntervalMs, EpochMs >::block_timestamp ( const fc::time_point & t)
inline

Definition at line 22 of file block_timestamp.hpp.

22 {
23 set_time_point(t);
24 }

◆ block_timestamp() [3/3]

template<uint16_t IntervalMs, uint64_t EpochMs>
sysio::chain::block_timestamp< IntervalMs, EpochMs >::block_timestamp ( const fc::time_point_sec & t)
inline

Definition at line 26 of file block_timestamp.hpp.

26 {
27 set_time_point(t);
28 }

Member Function Documentation

◆ maximum()

template<uint16_t IntervalMs, uint64_t EpochMs>
static block_timestamp sysio::chain::block_timestamp< IntervalMs, EpochMs >::maximum ( )
inlinestatic

Definition at line 30 of file block_timestamp.hpp.

30{ return block_timestamp( 0xffff ); }
Here is the call graph for this function:

◆ min()

template<uint16_t IntervalMs, uint64_t EpochMs>
static block_timestamp sysio::chain::block_timestamp< IntervalMs, EpochMs >::min ( )
inlinestatic

Definition at line 31 of file block_timestamp.hpp.

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

◆ next()

template<uint16_t IntervalMs, uint64_t EpochMs>
block_timestamp sysio::chain::block_timestamp< IntervalMs, EpochMs >::next ( ) const
inline

Definition at line 33 of file block_timestamp.hpp.

33 {
34 SYS_ASSERT( std::numeric_limits<uint32_t>::max() - slot >= 1, fc::overflow_exception, "block timestamp overflow" );
35 auto result = block_timestamp(*this);
36 result.slot += 1;
37 return result;
38 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
Here is the call graph for this function:

◆ operator fc::time_point()

template<uint16_t IntervalMs, uint64_t EpochMs>
sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator fc::time_point ( ) const
inline

Definition at line 44 of file block_timestamp.hpp.

44 {
45 int64_t msec = slot * (int64_t)IntervalMs;
46 msec += EpochMs;
47 return fc::time_point(fc::milliseconds(msec));
48 }
constexpr microseconds milliseconds(int64_t s)
Definition time.hpp:33
signed __int64 int64_t
Definition stdint.h:135
Here is the call graph for this function:

◆ operator!=()

template<uint16_t IntervalMs, uint64_t EpochMs>
bool sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator!= ( const block_timestamp< IntervalMs, EpochMs > & t) const
inline

Definition at line 59 of file block_timestamp.hpp.

59{ return slot != t.slot; }

◆ operator<()

template<uint16_t IntervalMs, uint64_t EpochMs>
bool sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator< ( const block_timestamp< IntervalMs, EpochMs > & t) const
inline

Definition at line 56 of file block_timestamp.hpp.

56{ return slot < t.slot; }

◆ operator<=()

template<uint16_t IntervalMs, uint64_t EpochMs>
bool sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator<= ( const block_timestamp< IntervalMs, EpochMs > & t) const
inline

Definition at line 57 of file block_timestamp.hpp.

57{ return slot <= t.slot; }

◆ operator=()

template<uint16_t IntervalMs, uint64_t EpochMs>
void sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator= ( const fc::time_point & t)
inline

Definition at line 50 of file block_timestamp.hpp.

50 {
51 set_time_point(t);
52 }

◆ operator==()

template<uint16_t IntervalMs, uint64_t EpochMs>
bool sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator== ( const block_timestamp< IntervalMs, EpochMs > & t) const
inline

Definition at line 58 of file block_timestamp.hpp.

58{ return slot == t.slot; }

◆ operator>()

template<uint16_t IntervalMs, uint64_t EpochMs>
bool sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator> ( const block_timestamp< IntervalMs, EpochMs > & t) const
inline

Definition at line 54 of file block_timestamp.hpp.

54{ return slot > t.slot; }

◆ operator>=()

template<uint16_t IntervalMs, uint64_t EpochMs>
bool sysio::chain::block_timestamp< IntervalMs, EpochMs >::operator>= ( const block_timestamp< IntervalMs, EpochMs > & t) const
inline

Definition at line 55 of file block_timestamp.hpp.

55{ return slot >= t.slot; }

◆ to_time_point()

template<uint16_t IntervalMs, uint64_t EpochMs>
fc::time_point sysio::chain::block_timestamp< IntervalMs, EpochMs >::to_time_point ( ) const
inline

Definition at line 40 of file block_timestamp.hpp.

40 {
41 return (fc::time_point)(*this);
42 }
Here is the caller graph for this function:

Member Data Documentation

◆ slot

template<uint16_t IntervalMs, uint64_t EpochMs>
uint32_t sysio::chain::block_timestamp< IntervalMs, EpochMs >::slot

Definition at line 60 of file block_timestamp.hpp.


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