The following behavior seems strange:
select time_to_sec(timediff('00:00:00', '00:00:01')); -- -1
select timediff('00:00:00', '00:00:01'); -- 00:00:01
select time_to_sec('00:00:01'); -- 1
According to the MySql reference timediff returns arg1 - arg2. Therefore, the result of the first statement is correct.
However, the 2nd statement returns the result of arg2 - arg1 or the absolute value of arg1 - args2. Therefore, f(g(x)) is not equal to y <- g(x), f(y) so to say. Can anyone explain?