Changeset 2204

Show
Ignore:
Timestamp:
27/07/2008 21:10:13 (5 months ago)
Author:
chris
Message:

Use the new time function when generating console log messages.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/common/Logging.cpp

    r2200 r2204  
    275275        if (sShowTime) 
    276276        { 
    277                 box_time_t time_now = GetCurrentBoxTime(); 
    278                 time_t seconds = BoxTimeToSeconds(time_now); 
    279                 int micros = BoxTimeToMicroSeconds(time_now) % MICRO_SEC_IN_SEC; 
    280  
    281                 struct tm tm_now, *tm_ptr = &tm_now; 
    282  
    283                 #ifdef WIN32 
    284                         if ((tm_ptr = localtime(&seconds)) != NULL) 
    285                 #else 
    286                         if (localtime_r(&seconds, &tm_now) != NULL) 
    287                 #endif 
    288                 { 
    289                         buf << std::setfill('0') << 
    290                                 std::setw(2) << tm_ptr->tm_hour << ":" <<  
    291                                 std::setw(2) << tm_ptr->tm_min  << ":" << 
    292                                 std::setw(2) << tm_ptr->tm_sec; 
    293  
    294                         if (sShowTimeMicros) 
    295                         { 
    296                                 buf << "." << std::setw(6) << micros; 
    297                         } 
    298  
    299                         buf << " "; 
    300                 } 
    301                 else 
    302                 { 
    303                         buf << strerror(errno); 
    304                         buf << " "; 
    305                 } 
     277                buf << FormatTime(GetCurrentBoxTime(), sShowTimeMicros); 
     278                buf << " "; 
    306279        } 
    307280