Fix a FIXME about the format and add a test.

While at it, use strftime on Unix too and use the thread safe versions
of localtime.