> Further, if you have just called localtime() or gmtime() there's no > point using %s either, you know the time_t value, that's what you > started with, you can simply print it.
If %s is a code-writing-time constant, yes. If %s comes from, say, the command line, not so much. I had no idea, before reading this thread, that date +%s would get the current time, convert it to a struct tm, and then convert that back to a time_t to print. With all the room for mismatches and other errors that entails, I'm slightly surprised it works even most of the time. More than ever, now, I'm convinced the struct tm family of calls badly needs to be abandoned to the "supported only for the sake of legacy code" graveyard, replaced by something saner. (I'm not so delusional as to think that will happen fast. It may not happen at all, but for the sake of sane time handling, I really really hope it does.) /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML mo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B