Boost logo

Boost Users :

Subject: Re: [Boost-users] posix_time::from_ftime versus DateTime.FromFileTime
From: Nikolai N Fetissov (nikolai-boost_at_[hidden])
Date: 2009-05-21 16:46:27


> I will appreciate any help in sorting out following issue:
>
> There is a value dt of type long. Calling boost::posix::time::from_ftime
> in
> c++ and
> DateTime.FromFileTime with that value produce "slightly" different
> results:
>
> dt = 128822886020000000
>
> c++: "2009-Mar-23 13:30:02"
> c#: {3/23/2009 9:30:02 AM}
>
> What I am doing wrong?
> c++ code:
> typedef signed __int64 int64;
> int64 dt = 128822886020000000;
> datetime = boost::posix_time::from_ftime<boost::posix_time::ptime>(dt);
> std::string testdt = boost::posix_time::to_simple_string(datetime);
>
> C# code:
> Int64 dt = 128822886020000000;
> startdate = DateTime.FromFileTime(dt);
>

Looks like C# does the time zone adjustment here (for EST/EDT?), while C++
gives you the raw UTC.

--
 Nikolai

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