Boost logo

Boost Users :

Subject: Re: [Boost-users] [date_time][serialization] Fast persistence of boost::date_time::ptime
From: Jeff Garland (azswdude_at_[hidden])
Date: 2010-01-28 08:20:09


Igor R wrote:
>> However on this glance this doesn’t seem possible non-intrusively. Perhaps
>> I’ve missed something, perhaps there’s a third way – I would be grateful if
>> any could share any ideas.
>
> Yes, it was already discussed here:
> http://groups.google.com/group/boost-list/browse_thread/thread/d799ca83118501e4/04b184b4c7af8c0b?show_docid=04b184b4c7af8c0b
>
> I believe nothing changed since then.

There's not a direct way to get at the internal representation of a ptime,
which varies based on how the library is compiled (64 or 96 bits depending on
settings -- the thread above isn't completely accurate on this point). If
it's critically important, of course, you could modify the source directly to
fit your particular setup and provide the internal representation for your app
to serialize (add a to_int64 for example). As a general rule, however, it's
unwise to store these values as integers since future versions of the library
might, for example, expand the epoch range and hence these serialized values
wouldn't be compatible -- that, and the aforementioned fact that the internal
size isn't fixed are a couple of the reasons there isn't direct access.

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