tags:

views:

18

answers:

1

Both functions GetTotalDays and GetDays of COleDateTimeSpan class returns number of days contained in object:

GetTotalDays: http://msdn.microsoft.com/en-us/library/d22h87z4(v=VS.80).aspx

This date/time-span value expressed in days

GetDays: http://msdn.microsoft.com/en-us/library/ze8kz4yw(v=VS.80).aspx

The day portion of this date/time-span value.

Could you please let me know if you see any difference between these functions? Actually I don't see it at all.

Thanks.

+1  A: 

They look the same apart from the fact that GetTotalDays returns double. If I had to guess, I'd say that originally this was intended to provide a means to express the fractional parts of a day as well as full days, and then someone at Microsoft decided this was not such a great idea. The API may therefore only exist to prevent problems with apps written to the original interface.

If you need to confirm for sure that they behave the same, run some tests comparing the result from each with sample data.

Steve Townsend
You are correct. The `double` value returned by `GetTotalDays()` is actually the internal representation of the time span value. See: http://msdn.microsoft.com/en-us/library/3bb4cy4w.aspx
Frank Bollack
v interesting background, thanks
Steve Townsend
Nah, it isn't, it gets truncated. vc\atlmfc\include\atlcomtime.inl
Hans Passant