9.168 ctime

This function may overflow its internal buffer if an invalid year is passed.

The ctime function need not be reentrant, and consequently is
not required to be thread safe. Implementations of ctime
typically write the time stamp into static buffer. If two threads
call ctime at roughly the same time, you might end up with the
wrong date in one of the threads, or some undefined string. There is
a re-entrant interface ctime_r.

A more flexible function is strftime. However, note that it is
locale dependent.