$include_dir="/home/hyper-archives/boost-users/include";
include("$include_dir/msg-header.inc")
?>
- Next message: Mateusz Loskot: "[Boost-users] [MPL][MP11] Return value of at_c for out of range index"
- Previous message: Adam Wulkiewicz: "Re: [Boost-users] Spatial search with boost r tree"
- Next in thread: Gavin Lambert: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
- Reply: Gavin Lambert: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
- Reply: Sergey Spiridonov: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
- Reply: Sergey Spiridonov: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
I am using C++14 and boost 1.64.0 (could move to newest boost), and need to
convert date and time pieces to a single value for milliseconds since the
epoch. This is what I have:
int64_t msSinceEpoch(int year,int month,int day,int hour,int minute,int
second,int ms)
{
struct std::tm t;
t.tm_sec = second;
t.tm_min = minute;
t.tm_hour = hour;
t.tm_mday = day;
t.tm_mon = month-1;
t.tm_year = year-1900;
t.tm_isdst = 0;
return (1000* timegm(&t))+ms; // is timegm cross-platform?
}
Is there a better way? Could not figure out how to use boost::chrono :(
Something else?
Kind Regards,
Vic
- Next message: Mateusz Loskot: "[Boost-users] [MPL][MP11] Return value of at_c for out of range index"
- Previous message: Adam Wulkiewicz: "Re: [Boost-users] Spatial search with boost r tree"
- Next in thread: Gavin Lambert: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
- Reply: Gavin Lambert: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
- Reply: Sergey Spiridonov: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
- Reply: Sergey Spiridonov: "Re: [Boost-users] convert separate year, month, day, hour, minute, secs, ms to milliseconds since epoch"
$include_dir="/home/hyper-archives/boost-users/include";
include("$include_dir/msg-footer.inc");
?>