Boost logo

Boost Users :

Subject: Re: [Boost-users] posix_time::from_ftimeversus DateTime.FromFileTime
From: Archie14 (admin_at_[hidden])
Date: 2009-05-22 08:13:17


Anders Dalvander <boost <at> dalvander.com> writes:

>
> Archie14 <at> lists.boost.org wrote:
> > 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}
> >
>
> DateTime.FromFileTimeUtc will probably produce the same results as
> boost::posix::time::from_ftime. Perhaps DateTime.SpecifyKind are needed
> as well.
>
> Regards,
> Anders Dalvander
>

Well, the value "dt" is obtained like this:
Int64 tm = startdate.ToFileTime();
DateTime dt = DateTime.FromFileTime (tm);

My guess is that if tm is expressed in Utc then I should get it back in Utc as
well, but it does not happen - I am getting it back in EST.

My question is this: suppose I have a value that holds FILETIME. My believe is
that it supposed to be understood the same way in C# or boost, without any
additional external knowledge of timezones etc.

I can provide two test projects if necessary to demonstrate the effect


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