Hello,
i think that i've found bug in date time library or maybe i made
something wrog.
SAMPLE CODE:
#include
#include <iostream>
using namespace boost::posix_time;
int main( int argc, char** argv )
{
time_t t = time( 0 );
std::cout << "time_t: " << ctime( &t ) << std::endl;
struct tm* t2 = localtime( &t );
std::cout << "struct tm: " << asctime( t2 ) << std::endl;
ptime t3 = from_time_t( t );
std::cout << "ptime from time_t: " << to_simple_string( t3 ) <<
std::endl;
ptime t4 = ptime_from_tm( *t2 );
std::cout << "ptime from tm: " << to_simple_string( t4 ) <<
std::endl;
return 0;
}
OUTPUT:
time_t: Fri May 1 14:22:01 2009
struct tm: Fri May 1 14:22:01 2009
ptime from time_t: 2009-May-01 12:22:01 // incorrect result
ptime from tm: 2009-May-01 14:22:01