fix bugs with time_point_sec
This commit is contained in:
parent
9173154160
commit
2b8b606d08
2 changed files with 4 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ namespace fc {
|
|||
inline void unpack( Stream& s, fc::time_point_sec& tp )
|
||||
{
|
||||
uint32_t sec;
|
||||
s.read( (char*)&usec, sizeof(sec) );
|
||||
s.read( (char*)&sec, sizeof(sec) );
|
||||
tp = fc::time_point() + fc::seconds(sec);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,16 +60,18 @@ namespace fc {
|
|||
time_point_sec()
|
||||
:utc_seconds(0){}
|
||||
|
||||
time_point_sec( const time_point& t = time_point() )
|
||||
time_point_sec( const time_point& t )
|
||||
:utc_seconds( t.time_since_epoch().count() / 1000000ll ){}
|
||||
|
||||
operator time_point()const { return time_point( fc::seconds( utc_seconds) ); }
|
||||
uint32_t sec_since_epoch()const { return utc_seconds; }
|
||||
|
||||
time_point_sec operator = ( const fc::time_point& t )
|
||||
{
|
||||
utc_seconds = t.time_since_epoch().count() / 1000000ll;
|
||||
return *this;
|
||||
}
|
||||
friend bool operator < ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds < b.utc_seconds; }
|
||||
|
||||
private:
|
||||
uint32_t utc_seconds;
|
||||
|
|
|
|||
Loading…
Reference in a new issue