http://llvm.org/bugs/show_bug.cgi?id=15177
Bug ID: 15177
Summary: Incorrect TimeValue conversion to Posix time and Win32
time
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Support Libraries
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
The TimeValue::toPosixTime() and TimeValue::toWin32Time() incorrectly convert
the timestamp value to Posix/Win32 ticks.
The two functions currently read as follows:
/// Converts the TimeValue into the corresponding number of "ticks" for
/// Posix, correcting for the difference in Posix zero time.
/// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan
1,1970)
uint64_t toPosixTime() const {
uint64_t result = seconds_ - PosixZeroTime.seconds_;
result += nanos_ / NANOSECONDS_PER_POSIX_TICK;
return result;
}
/// Converts the TimeValue into the corresponding number of "ticks" for
/// Win32 platforms, correcting for the difference in Win32 zero time.
/// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601)
uint64_t toWin32Time() const {
uint64_t result = seconds_ - Win32ZeroTime.seconds_;
result += nanos_ / NANOSECONDS_PER_WIN32_TICK;
return result;
}
There is no unit conversion performed when computing the seconds part. The
values of NANOSECONDS_PER_POSIX_TICK and NANOSECONDS_PER_WIN32_TICK also seem
to be wrong (they're both 100).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs