From c68b39543a80ea9c6fe749f277e077e95d43589e Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Wed, 21 Jan 2026 07:42:42 -0600 Subject: [PATCH] Use an int for fractional seconds --- ChangeLog | 5 +++++ inst/include/Rcpp/date_datetime/Datetime.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd5ecfd41..b970667e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2026-01-21 Dirk Eddelbuettel + + * inst/include/Rcpp/date_datetime/Datetime.h: Fractional seconds type + switched to 'int' for consistency, print format string re-adjusted + 2026-01-20 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/Datetime.h (format): Correct a diff --git a/inst/include/Rcpp/date_datetime/Datetime.h b/inst/include/Rcpp/date_datetime/Datetime.h index d4e4c9d59..c0c4589cf 100644 --- a/inst/include/Rcpp/date_datetime/Datetime.h +++ b/inst/include/Rcpp/date_datetime/Datetime.h @@ -79,7 +79,7 @@ namespace Rcpp { if (res == 0) { return std::string(""); } else { - res = ::snprintf(txtsec, 63, "%s.%06u", txtiso, m_us); + res = ::snprintf(txtsec, 63, "%s.%06d", txtiso, m_us); if (res <= 0) { return std::string(""); } else { @@ -93,7 +93,7 @@ namespace Rcpp { private: double m_dt; // fractional seconds since epoch struct tm m_tm; // standard time representation - unsigned int m_us; // microsecond (to complement m_tm) + int m_us; // microsecond (to complement m_tm) // update m_tm based on m_dt void update_tm() {