[Git][NTPsec/ntpsec][master] More calendar cleanup: struct isodate is gone.
Hal Murray
gitlab at mg.gitlab.com
Sun Mar 26 00:43:04 UTC 2017
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
bba626af by Hal Murray at 2017-03-25T17:41:00-07:00
More calendar cleanup: struct isodate is gone.
- - - - -
4 changed files:
- include/ntp_calendar.h
- tests/common/caltime.c
- tests/common/caltime.h
- tests/libntp/calendar.c
Changes:
=====================================
include/ntp_calendar.h
=====================================
--- a/include/ntp_calendar.h
+++ b/include/ntp_calendar.h
@@ -20,16 +20,6 @@ struct calendar {
uint8_t weekday; /* 0..7, 0=Sunday */
};
-/* ISO week calendar date */
-struct isodate {
- uint16_t year; /* year (A.D.) */
- uint8_t week; /* 1..53, week in year */
- uint8_t weekday; /* 1..7, 1=Monday */
- uint8_t hour; /* hour of day, midnight = 0 */
- uint8_t minute; /* minute of hour */
- uint8_t second; /* second of minute */
-};
-
/* general split representation */
typedef struct {
int32_t hi;
=====================================
tests/common/caltime.c
=====================================
--- a/tests/common/caltime.c
+++ b/tests/common/caltime.c
@@ -30,10 +30,3 @@ const char *CalendarToString(const struct calendar *cal) {
return str;
}
-
-const char *CalendarToStringISO(const struct isodate *iso) {
- char *str = malloc(255);
- snprintf(str, 255, "%hu-%u-%u %u:%u:%u\n", iso->year, (u_int)iso->week, (u_int)iso->weekday, (u_int)iso->hour, (u_int)iso->minute, (u_int)iso->second);
- return str;
-}
-
=====================================
tests/common/caltime.h
=====================================
--- a/tests/common/caltime.h
+++ b/tests/common/caltime.h
@@ -5,4 +5,3 @@
time_t timefunc(time_t*);
void settime(int y, int m, int d, int H, int M, int S);
const char *CalendarToString(const struct calendar *cal);
-const char *CalendarToStringISO(const struct isodate *iso);
=====================================
tests/libntp/calendar.c
=====================================
--- a/tests/libntp/calendar.c
+++ b/tests/libntp/calendar.c
@@ -45,22 +45,6 @@ bool IsEqualCA(const struct calendar *expected, const struct calendar *actual) {
}
-bool IsEqualISO(const struct isodate *expected, const struct isodate *actual) {
- if (expected->year == actual->year &&
- expected->week == actual->week &&
- expected->weekday == actual->weekday &&
- expected->hour == actual->hour &&
- expected->minute == actual->minute &&
- expected->second == actual->second) {
- return true;
- } else {
- /* coverity[leaked_storage] */
- printf("Expected: %s but was %s\n", CalendarToStringISO(expected), CalendarToStringISO(actual));
- return false;
- }
-}
-
-
const char *DateToString(const struct calendar *cal) {
char *str = malloc(255);
snprintf(str, 255, "%hu-%u-%u(%u)\n", cal->year, (u_int)cal->month, (u_int)cal->monthday, cal->yearday);
@@ -68,13 +52,6 @@ const char *DateToString(const struct calendar *cal) {
}
-const char *DateToStringISO(const struct isodate *iso) {
- char *str = malloc(255);
- snprintf(str, 255, "%hu-%u-%u\n", iso->year, (u_int)iso->week, (u_int)iso->weekday);
- return str;
-
-}
-
bool IsEqualDate(const struct calendar *expected, const struct calendar *actual) {
if (expected->year == actual->year &&
(!expected->yearday || expected->yearday == actual->yearday) &&
@@ -89,19 +66,6 @@ bool IsEqualDate(const struct calendar *expected, const struct calendar *actual)
}
-bool IsEqualDateISO(const struct isodate *expected, const struct isodate *actual) {
- if (expected->year == actual->year &&
- expected->week == actual->week &&
- expected->weekday == actual->weekday) {
- return true;
- } else {
- /* coverity[leaked_storage] */
- printf("Expected: %s but was %s\n", DateToStringISO(expected), DateToStringISO(actual));
- return false;
- }
-}
-
-
// ---------------------------------------------------------------------
// test cases
// ---------------------------------------------------------------------
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/bba626af0f02e30d36a4021b9d959b5c603ef986
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170326/f48099ee/attachment.html>
More information about the vc
mailing list