replace localtime/printf combinations with calls to ctime