Use muldiv64 to convert times without overflow

Copied from Xen's lib.c.