[Assorted-commits] SF.net SVN: assorted: [320] sandbox/trunk/src/cc/boost_serialization.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-04 19:15:53
|
Revision: 320 http://assorted.svn.sourceforge.net/assorted/?rev=320&view=rev Author: yangzhang Date: 2008-02-04 11:15:55 -0800 (Mon, 04 Feb 2008) Log Message: ----------- added boost serialization test Added Paths: ----------- sandbox/trunk/src/cc/boost_serialization.cc Added: sandbox/trunk/src/cc/boost_serialization.cc =================================================================== --- sandbox/trunk/src/cc/boost_serialization.cc (rev 0) +++ sandbox/trunk/src/cc/boost_serialization.cc 2008-02-04 19:15:55 UTC (rev 320) @@ -0,0 +1,44 @@ +// vim:et:sw=2:ts=2 + +#include <ctime> +#include <iostream> +#include <sstream> + +#include <sys/time.h> + +#include <boost/archive/binary_iarchive.hpp> +#include <boost/archive/binary_oarchive.hpp> + +using namespace std; +using namespace boost::archive; + +long long currentTimeMillis() { + using namespace std; + long long t; + struct timeval tv; + + gettimeofday(&tv, 0); + + t = tv.tv_sec; + t = (t *1000) + (tv.tv_usec/1000); + + return t; +} + +int main() { + stringstream ss; + long long x = currentTimeMillis(); + + //string s = ss.str(); + //s.c_str(); + + binary_oarchive oa(ss); + oa & x; + + binary_iarchive ia(ss); + ia & x; + + cout << x << endl; + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |