Changeset 376 for trunk/src/core
- Timestamp:
- 05/28/15 10:21:10 (10 years ago)
- Location:
- trunk/src/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/logger.cc
r368 r376 8 8 #include "nv/core/time.hh" 9 9 #include <cstdio> 10 #if NV_ PLATFORM == NV_WINDOWS10 #if NV_COMPILER == NV_MSVC 11 11 #define WIN32_LEAN_AND_MEAN 12 12 #include <Windows.h> … … 51 51 #define NV_LOG_LEVEL_NAME_PAD(level) (log_level_names_pad[ (level) / 10 ]) 52 52 53 #if NV_ PLATFORM == NV_WINDOWS53 #if NV_COMPILER == NV_MSVC 54 54 static unsigned short log_color[] = 55 55 { … … 145 145 size_t ssize = timestamp( stamp ); 146 146 147 #if NV_ PLATFORM == NV_WINDOWS147 #if NV_COMPILER == NV_MSVC 148 148 if ( m_color ) SetConsoleTextAttribute( m_handle, FOREGROUND_INTENSITY ); 149 149 WriteConsole( m_handle, stamp, ssize, nullptr, nullptr ); … … 170 170 else 171 171 fwrite( "] ", 2, 1, stdout ); 172 fwrite( stamp.data(), stamp.size(), 1, stdout );172 fwrite( message.data(), message.size(), 1, stdout ); 173 173 fwrite( "\n", 1, 1, stdout ); 174 174 #endif … … 233 233 : m_color( coloring ) 234 234 { 235 #if NV_ PLATFORM == NV_WINDOWS235 #if NV_COMPILER == NV_MSVC 236 236 m_handle = GetStdHandle( STD_OUTPUT_HANDLE ); 237 237 #else … … 240 240 } 241 241 242 size_t nv::log_sink::timestamp( char* buffer ) const242 nv::size_t nv::log_sink::timestamp( char* buffer ) const 243 243 { 244 244 uint32 ms = get_system_ms(); … … 248 248 unsigned int m = (unsigned int)(secs / 60) % 60; 249 249 unsigned int s = secs % 60; 250 #if NV_ PLATFORM == NV_WINDOWS250 #if NV_COMPILER == NV_MSVC 251 251 sprintf_s( buffer, 16, "%02d:%02d:%02d.%02d", h, m, s, mm ); 252 252 #else -
trunk/src/core/profiler.cc
r371 r376 12 12 using namespace nv; 13 13 14 #if defNV_MSVC14 #if NV_COMPILER == NV_MSVC 15 15 #define snprintf sprintf_s 16 16 #endif -
trunk/src/core/time.cc
r319 r376 7 7 #include "nv/core/logging.hh" 8 8 9 #include <ctime> 10 9 11 #if NV_COMPILER == NV_MSVC 10 12 #define WIN32_LEAN_AND_MEAN … … 13 15 #pragma intrinsic(__rdtsc) 14 16 #else 15 #include <unistd.h> 17 #if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS 18 // mingw doesn't have usleep nor nanosleep... 19 #include <windows.h> 20 #endif 21 // #include <unistd.h> 22 // #include <time.h> 23 // #include <sys/time.h> 24 // #include <sys/types.h> 25 #include <stdio.h> 26 #include <time.h> 16 27 #include <sys/time.h> 17 28 #endif 18 29 19 #include <ctime> 30 20 31 21 32 struct timer_impl … … 58 69 Sleep( ms ); 59 70 #else 60 usleep( ms * 1000 ); 71 #if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS 72 Sleep( ms ); 73 #else 74 struct timespec ts; 75 ts.tv_sec = 0; 76 ts.tv_nsec = ms * 1000000; 77 nanosleep(&ts, NULL); 78 // usleep( ms * 1000 ); 79 #endif 61 80 #endif 62 81 }
Note: See TracChangeset
for help on using the changeset viewer.