edA*_*a-y 3 c++ datetime boost
我需要将自纪元以来以毫秒为单位的时间转换为a boost::posix_time::ptime.我看到的唯一功能是转换,from_time_t但这只是在几秒钟内,将失去毫秒.
如何从epoch转换为ptime类型的毫秒?
ere*_*eOn 13
ms自纪元以来你的毫秒数在哪里:
ptime epoch_milliseconds_to_ptime(unsigned long int ms)
{
static const ptime epoch(date(1970, 1, 1));
return epoch + milliseconds(ms);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5595 次 |
| 最近记录: |