Revert "Simplify time formatting functions"

This reverts commit 3dc8c2c6e6bfedcc42931ceae14d63ac74ff580a.

Turns out we cannot get rid of the time_t use since it breaks on Windows.
Fix timers.