From 16bb157b91acd2cc65f3d6d9cb6bb24c398ea40c Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Sat, 10 Aug 2024 21:12:33 -0300 Subject: [PATCH] Fix #8211 - DATEADD truncates milliseconds for month and year deltas. --- src/jrd/SysFunction.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jrd/SysFunction.cpp b/src/jrd/SysFunction.cpp index e46db6e8ee..0088dfc0c0 100644 --- a/src/jrd/SysFunction.cpp +++ b/src/jrd/SysFunction.cpp @@ -2802,9 +2802,10 @@ dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, const NestValueArr ERR_post(Arg::Gds(rangeExceededStatus)); tm times; - timestamp.decode(×); + int fractions; + timestamp.decode(×, &fractions); times.tm_year += quantity; - timestamp.encode(×); + timestamp.encode(×, fractions); int day = times.tm_mday; timestamp.decode(×); @@ -2820,7 +2821,8 @@ dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, const NestValueArr ERR_post(Arg::Gds(rangeExceededStatus)); tm times; - timestamp.decode(×); + int fractions; + timestamp.decode(×, &fractions); int md[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -2855,7 +2857,7 @@ dsc* evlDateAdd(thread_db* tdbb, const SysFunction* function, const NestValueArr else if (times.tm_mday < 1) times.tm_mday = 1; - timestamp.encode(×); + timestamp.encode(×, fractions); } break;