[texhax] Time calculations within LaTeX?

E. Krishnan ekmath at asianetindia.com
Sat Feb 9 13:49:01 CET 2008

On Sat, 9 Feb 2008, Richard Hartmann wrote:

> On Feb 9, 2008 6:56 AM, E. Krishnan <ekmath at asianetindia.com> wrote:
>> Then \timediff10:15-16:00 gives 5.75 and \timediff10:15-01:00 gives 14.75.
> I found two issues with the function, one of which I could fix :)
> You need to reinitialize dh, dm, hrdec for the function to give the correct
> result when called more than once in a tex file.
> \setcounter{dh}{0}
> \setcounter{dm}{0}
> \setcounter{hrdec}{0}
> does the trick.

But I didn't have this issue.

> The other issue is that when the minute or hour values are equal, you
> get a null result, no matter what the other parameter is.

Oops! Sort of overlooked that case. Here's the modification to take care 
of this:

  \def\timediff#1:#2-#3:#4 {%


More information about the texhax mailing list