Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2006-02-01 10:51:12


>
> This will compile with gcc on Linux:
> boost::int64_t n = 1138736958000000LL;
>
> ptime::time_rep_type val(n);
> ptime t2(val);

This will also compile on Windows with VC 7.1.

> but it aborts with a bad_year exception. I didn't really track down why.

At the construction no exception will occur. But when I do:

to_simple_string( t2 )

I will get an "Unknown exception". It's thrown at
gregorian_calendar.ipp[122], since the year is negative. I have no
idea how this can happen.

> 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...

I was just thinking of how to store the time value in a database. It
seems to me that this would be the most efficient way of saving a
time. On this other hand when things change, like the internal
representation code will most likely break. So, I decided to store a
string, instead.

Thanks for the help.

Christian


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