adding time_io + switch to pragma once for datastream.hpp
This commit is contained in:
parent
6471249bb8
commit
9cd52de119
2 changed files with 19 additions and 3 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef _FC_DATASTREAM_HPP_
|
#pragma once
|
||||||
#define _FC_DATASTREAM_HPP_
|
|
||||||
#include <fc/utility.hpp>
|
#include <fc/utility.hpp>
|
||||||
#include <fc/error_report.hpp>
|
#include <fc/error_report.hpp>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -114,4 +113,3 @@ private:
|
||||||
|
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
18
include/fc/time_io.hpp
Normal file
18
include/fc/time_io.hpp
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#pragma once
|
||||||
|
#include <fc/time_point.hpp>
|
||||||
|
#include <fc/raw.hpp>
|
||||||
|
|
||||||
|
namespace fc {
|
||||||
|
namespace raw {
|
||||||
|
template<typename Stream, typename T>
|
||||||
|
void unpack( Stream& s, fc::time_point& v ) {
|
||||||
|
int64_t micro;
|
||||||
|
fc::raw::unpack(s, micro );
|
||||||
|
v = fc::time_point( fc::microseconds(micro);
|
||||||
|
}
|
||||||
|
template<typename Stream, typename T>
|
||||||
|
void pack( Stream& s, const fc::time_point& v ) {
|
||||||
|
fc::raw::pack( s, v.time_since_epoch().count() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue