From dbd4f8c46b968842d5fae1a1e86868934c90ad62 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 16 Jun 2014 08:46:56 +0200 Subject: [PATCH] SetTime_t: Use the sign-fixed modulo we computed * In C++03 and earlier, the sign of the modulo result is implementation defined (this was fixed in C++11). * Setting a negative time is not what we want here, so make sure we use the proper value. --- src/kits/support/DateTime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/support/DateTime.cpp b/src/kits/support/DateTime.cpp index 5778ccf5b9..aa4aaf6dd2 100644 --- a/src/kits/support/DateTime.cpp +++ b/src/kits/support/DateTime.cpp @@ -1410,7 +1410,7 @@ BDateTime::SetTime_t(time_t seconds) } BTime time; - time.AddSeconds(seconds % kSecondsPerDay); + time.AddSeconds(timePart); fTime.SetTime(time); BDate date(1970, 1, 1);