renard wrote:
When subtracting or adding months, DateTime does not know whether a
month has 28, 29, 30, or 31 days. It simply subtract/add the number of
specified months.
renard, you missed the point of my post. I'm asking about LSB vs MSB
subtraction.
With LSB subtraction, we subtract the Least Significant Bit first
(normally that's 'bit' as in 'byte', in this case it's 'bit' as in
'piece'). In DateTime, that's nanoseconds. So if we want to subtract
00:01:00.000000001 (1 hour, 1 nanosecond) we start by subtracting the
nanosecond, then we subtract the hour.
With MSB subtraction we subtract the Most Significant Bit first. In
DateTime, that's years, then months, days, hours, etc down to
nanoseconds. The reason this is significant is demonstrated in my
previous post, but here it is without code:
Imagine January 1st at midnight. Subtract 1 month, 14 days:
MSB: January 1 - 1 month = December 1
December 1 - 14 days = November 17
LSB: January 1 - 14 days = December 18
December 18 - 1 month = November 18
At some stage it appears DT:D has changed from one to the other.
I'm asking that we create two subtraction/addition functions: add_lsb
and add_msb (and their more relevent counterpoints subtract_lsb and
subtract_msb). We then decide which is the preffered method (IMHO, MSB)
and set in stone that that is the way we work. The standard subtract
function is then just an alias to subtract_msb() and the standard add
function is an alias to add_msb().
Cheers!
Rick Measham