posix_time::from_ftime versus DateTime.FromFileTime
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_ftimeboost::posix_time::ptime(dt); std::string testdt = boost::posix_time::to_simple_string(datetime); C# code: Int64 dt = 128822886020000000; startdate = DateTime.FromFileTime(dt);
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_ftimeboost::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
participants (2)
-
Archie14
-
Nikolai N Fetissov