Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-01-31 21:48:00


On Tue, 31 Jan 2006 10:06:00 -0500, Christian Henning wrote
> Seems to be broken on my machine:
>
> boost::int64_t nTime = 3434;
> ptime oTestTime( nTime );
>
> will result in:
>
> error C2664: 'boost::posix_time::ptime::ptime(boost::gregorian::date)
> ' : cannot convert parameter 1 from 'boost::int64_t' to 'boost::gregorian::date'
> Constructor for class 'boost::gregorian::date' is declared 'explicit'
>
> I'm using MSVC 7.1 and boost 1.33.1 .

This will compile with gcc on Linux:
  boost::int64_t n = 1138736958000000LL;

  ptime::time_rep_type val(n);
  ptime t2(val);

but it aborts with a bad_year exception. I didn't really track down why. I've
made this hard to do for good reason -- why are you trying to do this again?
What is the problem that makes you want to use the internal value? Not that
you can't get the value out either...

> In any event shouldn't a change of the internal representation 64bit
> -> 96bit result in an compiler error, when I use "ptime(const
> time_rep_type &)"?

Yes probably -- but if not it would be a runtime discovery of incorrect results.

Jeff


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