* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.34.2.3 2001/09/05 17:04:43 gson Exp $ */
+/* $Id: time.c,v 1.34.2.4 2001/09/06 00:34:06 marka Exp $ */
#include <config.h>
REQUIRE(len > 0);
now = (time_t) t->seconds;
- strftime(buf, len, "%b %d %X", localtime(&now));
- flen = strlen(buf);
- snprintf(buf + flen, len - flen,
- ".%03u", t->nanoseconds / 1000000);
+ flen = strftime(buf, len, "%b %d %X", localtime(&now));
+ INSIST(flen < len);
+ if (flen != 0)
+ snprintf(buf + flen, len - flen,
+ ".%03u", t->nanoseconds / 1000000);
+ else
+ snprintf(buf, len, "Bad 00 99:99:99.999");
}