Re: datetime:diff() question
- Posted by _tom (admin) Dec 08, 2017
- 1379 views
arguments are described as:
diff( end_time, start_time )
- documentation says calculation is: end_time - start_time
- source-code says calculation is: start_time - end_time
Something is backwards.
At the moment the documentation is wrong because it has to describe the source-code.
The question is now: what is the expected order of arguments in the diff function?
for those that believe that time moves in one direction only
- One could easily argue that diff( start_time, end_time ) makes sense; the return should be positive since you "expect" end_time to come after start_time.
for those just doing arithmetic
- The alternative ##diff( end_time, start_time) is more like "arithmetic". This looks like the original intent of this function.
Which one do we like better?
_tom