> However, I saw that I wrote rounding to seconds in my original mail. This should be rounding to ms...
Yes, I was comparing millisecond accuracy... > By the way, using reflector, following the ToOADate() code, you can see that they actually multiply the # ticks by 10000 at the > end... > But it is a bit weird: the resolution of .Net's DateTime is large enough, so why rounding? DateTime is stored as "ticks". There are 10000 milliseconds in a DateTime tick. So, it appears ToOADate first computes the number of millseconds then calculates the # of DateTime ticks that represents. That explains why it's off by up to a millisecond and that it only results in millisecond accuracy. So, other than sending doubles around, it would appear custom marshaling is your only option. With COM objects, I believe that means you'll have to write your own managed interfaces for the COM interfaces--which means not using tlbimp or not simply adding the COM DLL/EXE as a reference in your project. But, I haven't done any custom marshaling, so I'd have to look into a bit further. > > /P > > ----- Original Message ----- > From: "Peter Ritchie" <[EMAIL PROTECTED]> > To: <ADVANCED-DOTNET@DISCUSS.DEVELOP.COM> > Sent: Saturday, November 03, 2007 7:02 PM > Subject: Re: [ADVANCED-DOTNET] Marshalling of COM dates > > >>I think you'll have to declare your own managed interface for your native >> interfaces if you want to use custom marshaling (i.e. not use tlbimp) >> >> But, before going that route, how are the "COM dates" declared in the >> IDL? I've round-tripped dates through a native COM object without losing >> precision... Maybe there's something else at play here. >> >> =================================== >> This list is hosted by DevelopMentorĀ® http://www.develop.com >> >> View archives and manage your subscription(s) at http://discuss.develop.com >> > >=================================== >This list is hosted by DevelopMentorĀ® http://www.develop.com > >View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com