Skip to content

Commit 813561d

Browse files
committed
config UPDATE remove obsolete option
1 parent fbc6b39 commit 813561d

4 files changed

Lines changed: 3 additions & 26 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ else()
265265
set(INTERNAL_DOCS NO)
266266
endif()
267267

268-
option(ENABLE_DATE_AND_TIME_TYPE_COMPAT "Print ietf-yang-types 'date-and-time' values in an unknown timezone with '-00:00' instead of 'Z'" OFF)
269268
set(LYD_VALUE_SIZE "24" CACHE STRING "Maximum size in bytes of data node values that do not need to be allocated dynamically, minimum is 8")
270269
if(LYD_VALUE_SIZE LESS 8)
271270
message(FATAL_ERROR "Data node value size \"${LYD_VALUE_SIZE}\" is not valid.")

src/ly_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
# define LIBYANG_API_DECL
7979
#endif
8080

81-
/** date-and-time canonical value with an unknown time zone printed in backwards-compatible way with -00:00 instead of Z */
82-
#cmakedefine ENABLE_DATE_AND_TIME_TYPE_COMPAT
83-
8481
/** existence of regex.h */
8582
#cmakedefine HAVE_REGEX_H
8683

src/plugins_types/date_and_time.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,7 @@ lyplg_type_store_date_and_time(const struct ly_ctx *ctx, const struct lysc_type
120120
goto cleanup;
121121
}
122122

123-
if (!strncmp(((char *)value + value_size) - 6, "-00:00", 6)
124-
#ifndef ENABLE_DATE_AND_TIME_TYPE_COMPAT
125-
|| (((char *)value)[value_size - 1] == 'Z')
126-
#endif
127-
) {
123+
if (!strncmp(((char *)value + value_size) - 6, "-00:00", 6) || (((char *)value)[value_size - 1] == 'Z')) {
128124
/* unknown timezone, timezone format supported for backwards compatibility */
129125
val->unknown_tz = 1;
130126
}
@@ -272,7 +268,6 @@ lyplg_type_print_date_and_time(const struct ly_ctx *ctx, const struct lyd_value
272268
struct lyd_value_date_and_time *val;
273269
struct tm tm;
274270
char *ret;
275-
const char *unknown_tz;
276271

277272
LYD_VALUE_GET(value, val);
278273

@@ -308,14 +303,9 @@ lyplg_type_print_date_and_time(const struct ly_ctx *ctx, const struct lyd_value
308303
return NULL;
309304
}
310305

311-
#ifdef ENABLE_DATE_AND_TIME_TYPE_COMPAT
312-
unknown_tz = "-00:00";
313-
#else
314-
unknown_tz = "Z";
315-
#endif
316-
if (asprintf(&ret, "%04d-%02d-%02dT%02d:%02d:%02d%s%s%s",
306+
if (asprintf(&ret, "%04d-%02d-%02dT%02d:%02d:%02d%s%sZ",
317307
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
318-
val->fractions_s ? "." : "", val->fractions_s ? val->fractions_s : "", unknown_tz) == -1) {
308+
val->fractions_s ? "." : "", val->fractions_s ? val->fractions_s : "") == -1) {
319309
return NULL;
320310
}
321311
} else {

tests/utests/types/yang_types.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ test_data_xml(void **state)
9797
UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
9898

9999
/* date-and-time */
100-
#ifdef ENABLE_DATE_AND_TIME_TYPE_COMPAT
101-
TEST_SUCCESS_XML("a", "l", "2005-05-25T23:15:15.88888Z", STRING, "2005-05-25T21:15:15.88888-02:00");
102-
#else
103100
TEST_SUCCESS_XML("a", "l", "2005-05-25T23:15:15.88888Z", STRING, "2005-05-25T23:15:15.88888Z");
104-
#endif
105101
TEST_SUCCESS_XML("a", "l", "2005-05-31T23:15:15-08:59", STRING, "2005-06-01T06:14:15-02:00");
106102
TEST_SUCCESS_XML("a", "l", "2005-06-01T11:15:15-11:00", STRING, "2005-06-01T20:15:15-02:00");
107103

@@ -116,13 +112,8 @@ test_data_xml(void **state)
116112
TEST_SUCCESS_XML("a", "l", "2005-05-25T23:15:15.88888+04:30", STRING, "2005-05-25T16:45:15.88888-02:00");
117113

118114
/* unknown timezone -- timezone conversion MUST NOT happen */
119-
#ifdef ENABLE_DATE_AND_TIME_TYPE_COMPAT
120-
TEST_SUCCESS_XML("a", "l", "2017-02-01T00:00:00-00:00", STRING, "2017-02-01T00:00:00-00:00");
121-
TEST_SUCCESS_XML("a", "l", "2021-02-29T00:00:00-00:00", STRING, "2021-03-01T00:00:00-00:00");
122-
#else
123115
TEST_SUCCESS_XML("a", "l", "2017-02-01T00:00:00-00:00", STRING, "2017-02-01T00:00:00Z");
124116
TEST_SUCCESS_XML("a", "l", "2021-02-29T00:00:00-00:00", STRING, "2021-03-01T00:00:00Z");
125-
#endif
126117

127118
TEST_ERROR_XML("a", "l", "2005-05-31T23:15:15.-08:00", LY_EVALID);
128119
CHECK_LOG_CTX("Unsatisfied pattern - \"2005-05-31T23:15:15.-08:00\" does not match "

0 commit comments

Comments
 (0)