|
Boost : |
Subject: Re: [boost] Cross-platform date/time problems
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-11-02 13:38:21
Zachary Turner wrote:
>> 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.
>>
>>
> That's just it, I'm trying to use ptime.
Then why not simply send ptime over the network?
> A conversion has to exist
> somewhere, why shouldn't it exist in boost rather than me duplicating code
> for no particular benefit? If I decide that a unix epoch based time is
> going to be my "cross-platform network format" when I serialize /
> deserialize then I lose precision on Windows. If I decide that a windows
> epoch based time is going to be my cross platform network format, then I
> have to make an almost exact duplicate of the from_ftime function.
That choice is up to you. However, as I implied earlier, I see no point
in using platform-dependent types in a cross-platform code, except for
the lower-level wrappers around the native OS API.
> Besides, my application does raw parsing of an NTFS filesystem. You can
> have NTFS filesystems on Linux. Usually the APIs abstract the fact that
> times are stored internally in the filesystem in FILETIME format, but that's
> no longer the case when you have raw access to the file systme.
I can't comment on that as I'm not aware of NTFS internals. I'm not the
maintainer of Boost.DateTime, but this use case doesn't convince me as
it looks too exotic to me.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk