Is TimeSpan unnecessary?

后端 未结 9 1933
野的像风
野的像风 2020-12-15 06:33

EDIT 2009-Nov-04

OK, so it\'s been a little while since I first posted this question. It seems to me that many of the initial responders failed to r

9条回答
  •  自闭症患者
    2020-12-15 07:03

    (Speaking as a mathematician) It's because arithmetic operations on a "date" aren't closed or well defined, necessitating the need for an additional structure.

    For example, January 1, 2000 - December 1, 1999 = ... ? We know there's 31 days between them, but if this were interpreted as a date, then the answer is Epoch (i.e., zero) + 31 days. This is not a valid "date" anymore.

    Similarly, all the arithmetic operations on integers aren't well defined (1 / 2 has no answer in the integers .. integer math returns zero here, but 0 * 2 = 0, not 1 as you would expect). This necessitates the need for an additional structure that we call fractions.

提交回复
热议问题