Skip to content

Commit

Permalink
tree schema UPDATE disable DST adjustment when checking date (#2310)
Browse files Browse the repository at this point in the history
This is especially important for custom DST settings
  • Loading branch information
Troltsch authored Oct 14, 2024
1 parent 361391d commit cf919b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tree_schema_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ lysp_check_date(struct lysp_ctx *ctx, const char *date, size_t date_len, const c
}
memcpy(&tm_, &tm, sizeof tm);

/* DST may move the hour back resulting in a different day */
tm_.tm_hour = 1;
/* Disabling DST: Set tm_isdst to -1 so that mktime() won't adjust for daylight saving time. */
tm_.tm_isdst = -1;

mktime(&tm_); /* mktime modifies tm_ if it refers invalid date */
if (tm.tm_mday != tm_.tm_mday) { /* e.g 2018-02-29 -> 2018-03-01 */
Expand Down

0 comments on commit cf919b8

Please sign in to comment.