[llvm-commits] [llvm] r115503 - /llvm/trunk/unittests/Support/System.cpp

John Tytgat john at bass-software.com
Mon Oct 4 17:22:54 PDT 2010


In message <20101004123120.4CCB62A6C130 at llvm.org>
          Francois Pichet <pichet2000 at gmail.com> wrote:

> Author: fpichet
> Date: Mon Oct  4 07:31:20 2010
> New Revision: 115503
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=115503&view=rev
> Log:
> static_cast to long, otherwise MSVC 2008 won't compile.
>
> Modified:
>     llvm/trunk/unittests/Support/System.cpp
> 
> Modified: llvm/trunk/unittests/Support/System.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/System.cpp?rev=115503&r1=115502&r2=115503&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Support/System.cpp (original)
> +++ llvm/trunk/unittests/Support/System.cpp Mon Oct  4 07:31:20 2010
> @@ -11,6 +11,6 @@
>  TEST_F(SystemTest, TimeValue) {
>    sys::TimeValue now = sys::TimeValue::now();
>    time_t now_t = time(NULL);
> -  EXPECT_TRUE(abs(static_cast<time_t>(now_t - now.toEpochTime())) < 2);
> +  EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2);

I might be wrong but this doesn't feel Win64 safe as 'long' is still 32-bit
while 'time_t' is 64-bit wide (of course only when the time difference would
be 1<<32 +/- 1).

John.
-- 
John Tytgat
John at bass-software.com



More information about the llvm-commits mailing list