推荐: blog.csdn.net/aquester https://github.com/eyjian https://www.cnblogs.com/aquester http://blog.chinaunix.net/uid/20682147.html
全部博文(595)
分类: C/C++
2013-01-17 15:10:32
#include
boost::posix_time::ptime now = boost::posix_time::from_time_t(time(NULL));
boost::posix_time::to_simple_string(now); // CCYY-mmm-dd hh:mm:ss.fffffff
boost::posix_time::to_iso_string(now); // YYYYMMDDTHHMMSS
boost::posix_time::to_iso_extended_string(now); // YYYY-MM-DDTHH:MM:SS
#include
void sleep(uint32_t seconds)
{
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += seconds;
boost::thread::sleep(xt); // Sleep for 1 second
}