From b9e88d4186d46b3fc676457224d72405d10f0c1e Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Sat, 7 Apr 2012 04:55:02 +0000 Subject: Fix a integer trauction issue - calculating the current time in nanoseconds in 32-bit expression would cause pthread_cond_timedwait to time out immediately. Add explicit casts to the TimeValue::TimeValue ctor that takes a struct timeval and change the NanoSecsPerSec etc constants defined in TimeValue to be uint64_t so any other calculations involving these should be promoted to 64-bit even when lldb is built for 32-bit. , , . llvm-svn: 154250 --- lldb/source/Host/common/TimeValue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Host/common/TimeValue.cpp') diff --git a/lldb/source/Host/common/TimeValue.cpp b/lldb/source/Host/common/TimeValue.cpp index 95ecd402e0c..303ac94058b 100644 --- a/lldb/source/Host/common/TimeValue.cpp +++ b/lldb/source/Host/common/TimeValue.cpp @@ -38,12 +38,12 @@ TimeValue::TimeValue(const TimeValue& rhs) : } TimeValue::TimeValue(const struct timespec& ts) : - m_nano_seconds (ts.tv_sec * NanoSecPerSec + ts.tv_nsec) + m_nano_seconds ((uint64_t) ts.tv_sec * NanoSecPerSec + ts.tv_nsec) { } TimeValue::TimeValue(const struct timeval& tv) : - m_nano_seconds (tv.tv_sec * NanoSecPerSec + tv.tv_usec * NanoSecPerMicroSec) + m_nano_seconds ((uint64_t) tv.tv_sec * NanoSecPerSec + (uint64_t) tv.tv_usec * NanoSecPerMicroSec) { } -- cgit v1.2.3