diff options
author | Jason Molenda <jmolenda@apple.com> | 2012-04-07 04:55:02 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2012-04-07 04:55:02 +0000 |
commit | b9e88d4186d46b3fc676457224d72405d10f0c1e (patch) | |
tree | 7949bffe25052d6aa62c711d27dc0de88fc6c58e /lldb/source/Host/common/TimeValue.cpp | |
parent | 5758f495da70f6cd2637f1679051d667571ed2f4 (diff) | |
download | bcm5719-llvm-b9e88d4186d46b3fc676457224d72405d10f0c1e.tar.gz bcm5719-llvm-b9e88d4186d46b3fc676457224d72405d10f0c1e.zip |
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.
<rdar://problem/11204073>, <rdar://problem/11179821>, <rdar://problem/11194705>.
llvm-svn: 154250
Diffstat (limited to 'lldb/source/Host/common/TimeValue.cpp')
-rw-r--r-- | lldb/source/Host/common/TimeValue.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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) { } |