[LLVMbugs] [Bug 15177] New: Incorrect TimeValue conversion to Posix time and Win32 time

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 6 06:45:17 PST 2013


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: unassignedbugs at nondot.org
          Reporter: stefan.bucur at epfl.ch
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130206/6928e607/attachment.html>


More information about the llvm-bugs mailing list