|
|
|
|
|
by JadeNB
4033 days ago
|
|
> "When doing math that deals with time, specifically different units of time, it can lead to unexpected results if you are not careful with the ordering" Not arguing with you, but with the poster: I think that a deeper lesson might be the important realisation that, unlike 'day' or 'hour', 'month' is not a unit of time! (At least, not any more than 'moment' is. (I know, I know, https://en.wikipedia.org/wiki/Moment_(time), but you know what I mean.)) |
|
Not a 'fixed unit' of time. Where I define 'fixed' as being always of the same size (like gram or meter).
My next thought is that day is also not fixed in case of daylight saving and leap seconds. A day has many definitions: astronomical, 24 hours, calendar, etc.
Maybe we can also see this problem with 'hour'; but in that case it would be more contrived.
Bottom line: programming time is hard, be aware of that.
See this post for some common pitfalls:
http://infiniteundo.com/post/25326999628/falsehoods-programm...