Changeset 2482

Show
Ignore:
Timestamp:
29/03/2009 14:08:12 (17 months ago)
Author:
chris
Message:

Add date to file logger, as requested by Kenny Millington.

Location:
box/trunk/lib/common
Files:
4 modified

Legend:

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

    r2203 r2482  
    5454} 
    5555 
    56 std::string FormatTime(box_time_t time, bool showMicros) 
     56std::string FormatTime(box_time_t time, bool includeDate, bool showMicros) 
    5757{ 
    5858        std::ostringstream buf; 
     
    6969        #endif 
    7070        { 
    71                 buf << std::setfill('0') << 
    72                         std::setw(2) << tm_ptr->tm_hour << ":" <<  
     71                buf << std::setfill('0'); 
     72 
     73                if (includeDate) 
     74                { 
     75                        buf <<  std::setw(4) << (tm_ptr->tm_year + 1900) << "-" << 
     76                                std::setw(2) << (tm_ptr->tm_mon  + 1) << "-" << 
     77                                std::setw(2) << (tm_ptr->tm_mday) << " "; 
     78                } 
     79 
     80                buf <<  std::setw(2) << tm_ptr->tm_hour << ":" <<  
    7381                        std::setw(2) << tm_ptr->tm_min  << ":" << 
    7482                        std::setw(2) << tm_ptr->tm_sec; 
  • box/trunk/lib/common/BoxTime.h

    r2203 r2482  
    4141} 
    4242 
    43 std::string FormatTime(box_time_t time, bool showMicros = false); 
     43std::string FormatTime(box_time_t time, bool includeDate, 
     44        bool showMicros = false); 
    4445 
    4546#endif // BOXTIME__H 
  • box/trunk/lib/common/Logging.cpp

    r2466 r2482  
    289289        if (sShowTime) 
    290290        { 
    291                 buf << FormatTime(GetCurrentBoxTime(), sShowTimeMicros); 
     291                buf << FormatTime(GetCurrentBoxTime(), false, sShowTimeMicros); 
    292292                buf << " "; 
    293293        } 
     
    450450 
    451451        std::ostringstream buf; 
    452         buf << FormatTime(GetCurrentBoxTime(), false); 
     452        buf << FormatTime(GetCurrentBoxTime(), true, false); 
    453453        buf << " "; 
    454454 
  • box/trunk/lib/common/Timer.cpp

    r2465 r2482  
    358358        { 
    359359                BOX_TRACE(TIMER_ID "initialised for " << timeoutSecs << 
    360                         " secs, to fire at " << FormatTime(mExpires, true)); 
     360                        " secs, to fire at " << FormatTime(mExpires, false, true)); 
    361361        } 
    362362        #endif