Changeset 121 for trunk/src/time.cc


Ignore:
Timestamp:
06/15/13 17:47:57 (12 years ago)
Author:
epyon
Message:
  • Nova builds with -Weverything/-Wall/-pedantic/etc on: on MSVC 2012 on GCC 4.6.3 on clang 3.2
  • ... without a single fucking warning.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/time.cc

    r34 r121  
    4242static timer_impl zero_timer;
    4343
    44 volatile nv::uint64 nv::get_ticks()
     44nv::uint64 nv::get_ticks()
    4545{
    4646#if NV_COMPILER == NV_MSVC
    4747        return __rdtsc();
    48 #elif NV_COMPILER == NV_GNUC
    49         register long long ticks asm("eax");
     48#else
     49        register long long ticks asm("eax") = 0;
    5050        asm volatile (".byte 15, 49" : : : "eax", "edx");
    51         return ticks;
    52 #else
    53         return 0; // unsupported
     51        return static_cast<nv::uint64>( ticks );
    5452#endif
    5553}
     
    5957#if NV_COMPILER == NV_MSVC
    6058        Sleep( ms );
    61 #elif NV_COMPILER == NV_GNUC
     59#else
    6260        usleep( ms * 1000 );
    63 #else
    6461#endif
    6562}
     
    8582        struct timeval now;
    8683        gettimeofday(&now, NULL);
    87         return (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000;
     84        return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000 );
    8885#endif
    8986}
     
    9996        struct timeval now;
    10097        gettimeofday(&now, NULL);
    101         return (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec);
     98        return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec) );
    10299#endif
    103100}
Note: See TracChangeset for help on using the changeset viewer.