|
Boost Users : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2007-06-02 12:11:35
Jens Schluetter wrote:
> Hi,
>
> I'm kinda stuck. I'm working on an inter op library to glue C++ code
> that uses ptime with C# code that uses (of course) the .NET DateTime
> format. Since the system needs the outmost performance I'm looking for a
> way to use binary conversion. Conversion from .NET to ptime is easy
> since there is a from_ftime<> conversion method, however the other
> direction is somewhat blocked since no ptime to FILE_TIME conversion
> exists.
>
> My current workaround is using ISO time strings but performance is
> somewhat dismal since there is a lot of string <> binary conversion.
> Does anyone know of a more straight forward (binary)way of converting?
> And just in case, using regular time_t as common denominator is not an
> option since at leas millisecond resolution is required.
>
> I'd be greatful for any recommendations/ideas.
Why don't you write a to_ftime function? You can get all the elements out of
the ptime to calculate back to a ftime probably as efficiently as the to_ftime
call. Of course on the way back to ftime you have to be at least aware that
ptime can hold values outside the range of ftime (like not_a_date_time,
infinities, and dates < 1601) -- presumably you would want an exception there.
If you look at date_time/filetime_functions.hpp that should give you some ideas.
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