From 755dcbe5baebd6fcab6fa051c97aaa9ae47b6636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 12 Jan 2024 13:36:25 +0100 Subject: [PATCH] Fix timepoint_to_timespec bug for std/boost chrono timepoints --- include/boost/interprocess/sync/posix/timepoint_to_timespec.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/interprocess/sync/posix/timepoint_to_timespec.hpp b/include/boost/interprocess/sync/posix/timepoint_to_timespec.hpp index 297fe8a..956fd5b 100644 --- a/include/boost/interprocess/sync/posix/timepoint_to_timespec.hpp +++ b/include/boost/interprocess/sync/posix/timepoint_to_timespec.hpp @@ -73,7 +73,7 @@ inline timespec timepoint_to_timespec ( const TimePoint &tm const double factor = double(duration_t::period::num)/double(duration_t::period::den); const double res = d.count()*factor; ts.tv_sec = static_cast(res); - ts.tv_nsec = static_cast(res - double(ts.tv_sec)); + ts.tv_nsec = static_cast(1000000000.0*(res - double(ts.tv_sec))); } return ts; }