|
Boost Users : |
Subject: [Boost-users] [date_time] unexpected behaviour from microsec_clock::local_time on 32 bit system.
From: werasm_at_[hidden]
Date: 2009-08-05 05:08:20
Hi all,
I have the following little program (I'm using mingw 3.4.2 (32bit) ):
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
int main()
{
using namespace boost;
using namespace boost::posix_time;
//Time now (since epoch in seconds)...
static const ptime secSinceEpoch( second_clock::local_time() );
//Time now (since epoch in micros)...
static const ptime microsecSinceEpoch( microsec_clock::local_time() );
//Elapsed should be close to zero...
time_duration elapsed = microsecSinceEpoch - secSinceEpoch;
std::cout << "elapsed: " << elapsed.total_milliseconds() << std::endl;
return 0;
}
It outputs: "elapsed: -1240428644900", whereas I expected it to
output a positive value.
It therefore seems that microsec_clock::local_time() wraps. Is 64-bits
a pre-requisite for this library to work correctly or is there some remedy?
Kind regards,
Werner
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net