Boost logo

Boost :

Subject: Re: [boost] Cross-platform date/time problems
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-11-01 13:58:55


Zachary Turner wrote:
> On Sun, Nov 1, 2009 at 3:42 AM, Andrey Semashev
> <andrey.semashev_at_[hidden]>wrote:
>
>> Actually, FILETIME is a structure, the function just optimises its
>> operation by converting it to uint64_t internally, which may not be valid on
>> Linux. Obviously, this structure is not available on Linux, so there's no
>> way you can acquire it from OS.
>>
>
>> The from_ftime function (and all other facilities it uses) are targeted for
>> Windows platform and operate on FILETIME, not on some opaque uint64_t.
>> FILETIME has additional value semantics, such as the base date and
>> resolution. These semantics are not described for Linux.
>>
> I agree, but the point is that semantically a FILETIME is defined as "an
> opaque structure representing the number of 100-nanosecond intervals since
> January 1, 1601". Integer types are perfectly capable of representing
> exactly the same semantic definition, so why not? I don't think it even
> requires any code changes except to remove a single #ifdef in the date_time
> header files.

It does. At least byte order issues should be taken into account.

Anyway, I don't think that bringing Windows-specific code to other
platforms is a good idea. If you want cross-platform code, use
cross-platform types, such as time_t, ptime or local_time.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk