+4852. [bug] Handle strftime() failing in isc_time_formatISO8601ms.
+ Add REQUIRE's and INSIST's to isc_time_formattimestamp,
+ isc_time_formathttptimestamp, isc_time_formatISO8601,
+ isc_time_formatISO8601ms. [RT #46892]
+
4851. [port] Support using kyua as well as atf-run to run the unit
tests. [RT #46853]
struct tm tm;
#endif
+ REQUIRE(t != NULL);
+ INSIST(t->nanoseconds < NS_PER_S);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
now = (time_t) t->seconds;
struct tm tm;
#endif
+ REQUIRE(t != NULL);
+ INSIST(t->nanoseconds < NS_PER_S);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
/*
REQUIRE(buf != NULL);
REQUIRE(t != NULL);
+
p = isc_tm_strptime(buf, "%a, %d %b %Y %H:%M:%S", &t_tm);
if (p == NULL)
return (ISC_R_UNEXPECTED);
struct tm tm;
#endif
+ REQUIRE(t != NULL);
+ INSIST(t->nanoseconds < NS_PER_S);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
now = (time_t)t->seconds;
struct tm tm;
#endif
+ REQUIRE(t != NULL);
+ INSIST(t->nanoseconds < NS_PER_S);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
now = (time_t)t->seconds;
flen = strftime(buf, len, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
#endif
INSIST(flen < len);
- if (flen == len - 5) {
- flen -= 1; /* rewind one character */
+ if (flen > 0U && len - flen >= 5) {
+ flen -= 1; /* rewind one character (Z) */
snprintf(buf + flen, len - flen, ".%03uZ",
t->nanoseconds / NS_PER_MS);
}
char DateBuf[50];
char TimeBuf[50];
+ REQUIRE(t != NULL);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
+
if (FileTimeToLocalFileTime(&t->absolute, &localft) &&
FileTimeToSystemTime(&localft, &st)) {
GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, "dd-MMM-yyyy",
/* strftime() format: "%a, %d %b %Y %H:%M:%S GMT" */
+ REQUIRE(t != NULL);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
+
if (FileTimeToSystemTime(&t->absolute, &st)) {
GetDateFormat(LOCALE_USER_DEFAULT, 0, &st,
"ddd',' dd MMM yyyy", DateBuf, 50);
REQUIRE(buf != NULL);
REQUIRE(t != NULL);
+
p = isc_tm_strptime(buf, "%a, %d %b %Y %H:%M:%S", &t_tm);
if (p == NULL)
return (ISC_R_UNEXPECTED);
/* strtime() format: "%Y-%m-%dT%H:%M:%SZ" */
+ REQUIRE(t != NULL);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
+
if (FileTimeToSystemTime(&t->absolute, &st)) {
GetDateFormat(LOCALE_NEUTRAL, 0, &st, "yyyy-MM-dd",
DateBuf, 50);
/* strtime() format: "%Y-%m-%dT%H:%M:%S.SSSZ" */
+ REQUIRE(t != NULL);
+ REQUIRE(buf != NULL);
REQUIRE(len > 0);
+
if (FileTimeToSystemTime(&t->absolute, &st)) {
GetDateFormat(LOCALE_NEUTRAL, 0, &st, "yyyy-MM-dd",
DateBuf, 50);