be configured for the distribution targets. Harlan Stenn.
* [Bug 2883] ntpd crashes on exit with empty driftfile. Miroslav Lichvar.
* [Bug 2886] Mis-spelling: "outlyer" should be "outlier". dave@horsfall.org
+* [Bug 2888] streamline calendar functions. perlinger@ntp.org
* [Bug 2889] ntp-dev-4.3.67 does not build on Windows. perlinger@ntp.org
* [Bug 2890] Ignore ENOBUFS on routing netlink socket. Konstantin Khlebnikov.
+ * [Bug 2906] make check needs better support for pthreads. Harlan Stenn.
+ * [Bug 2907] dist* build targets require our libevent/ to be enabled. HStenn.
* libntp/emalloc.c: Remove explicit include of stdint.h. Harlan Stenn.
* Put Unity CPPFLAGS items in unity_config.h. Harlan Stenn.
* tests/ntpd/g_leapsec.cpp typo fix. Harlan Stenn.
}
char *
-CalendarFromIsoToString(const struct isodate iso) {
-
+CalendarFromIsoToString(
+ const struct isodate *iso)
+{
- char * str = malloc (sizeof (char) * 100);
+ char * str = emalloc (sizeof (char) * 100);
-
- char buffer[100] ="";
- snprintf(buffer, 100, "%u", iso.year);
- strcat(str, buffer);
- strcat(str, "-");
- snprintf(buffer, 100, "%u", (u_int)iso.week);
- strcat(str, buffer);
- strcat(str, "-");
- snprintf(buffer, 100, "%u", (u_int)iso.weekday);
- strcat(str, buffer);
- snprintf(buffer, 100, "%u", (u_int)iso.hour);
- strcat(str, buffer);
- strcat(str, ":");
- snprintf(buffer, 100, "%u", (u_int)iso.minute);
- strcat(str, buffer);
- strcat(str, ":");
- snprintf(buffer, 100, "%u", (u_int)iso.second);
- strcat(str, buffer);
-
+ snprintf(str, 100, "%u-W%02u-%02u %02u:%02u:%02u",
+ iso->year, (u_int)iso->week, (u_int)iso->weekday,
+ (u_int)iso->hour, (u_int)iso->minute, (u_int)iso->second);
+ str[99] = '\0'; /* paranoia rulez! */
return str;
}
}
char *
-DateFromCalToString(const struct calendar cal) {
+DateFromCalToString(
+ const struct calendar *cal)
+{
- char * str = malloc (sizeof (char) * 100);
+ char * str = emalloc (sizeof (char) * 100);
-
- char buffer[100] ="";
- snprintf(buffer, 100, "%u", cal.year);
- strcat(str, buffer);
- strcat(str, "-");
- snprintf(buffer, 100, "%u", (u_int)cal.month);
- strcat(str, buffer);
- strcat(str, "-");
- snprintf(buffer, 100, "%u", (u_int)cal.monthday);
- strcat(str, buffer);
- strcat(str, " (");
- snprintf(buffer, 100, "%u", cal.yearday);
- strcat(str, buffer);
- strcat(str, ")");
-
+ snprintf(str, 100, "%u-%02u-%02u (%u)",
+ cal->year, (u_int)cal->month, (u_int)cal->monthday,
+ cal->yearday);
+ str[99] = '\0'; /* paranoia rulez! */
return str;
}
char *
-DateFromIsoToString(const struct isodate iso) {
+DateFromIsoToString(
+ const struct isodate *iso)
+{
- char * str = malloc (sizeof (char) * 100);
+ char * str = emalloc (sizeof (char) * 100);
-
- char buffer[100] ="";
- snprintf(buffer, 100, "%u", iso.year);
- strcat(str, buffer);
- strcat(str, "-");
- snprintf(buffer, 100, "%u", (u_int)iso.week);
- strcat(str, buffer);
- strcat(str, "-");
- snprintf(buffer, 100, "%u", (u_int)iso.weekday);
- strcat(str, buffer);
-
+ snprintf(str, 100, "%u-W%02u-%02u",
+ iso->year, (u_int)iso->week, (u_int)iso->weekday);
+ str[99] = '\0'; /* paranoia rulez! */
return str;
}