| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# Message.cpp File Reference

`#include <string>`
`#include <iostream>`
`#include <iomanip>`
`#include <cstdlib>`
`#include <cctype>`
`#include "GaudiKernel/IMessageSvc.h"`
`#include "GaudiKernel/Message.h"`
`#include "GaudiKernel/Timing.h"`
`#include "GaudiKernel/time_r.h"`

Include dependency graph for Message.cpp:

Go to the source code of this file.

## Defines
#define | SET(x) case x: level=#x; break
## Functions
std::string | formattedTime (std::string fmt, bool universal=false)
std::ostream & | operator<< (std::ostream &stream, const Message &msg)
bool | operator== (const Message &a, const Message &b)
std::string | formattedTime (std::string fmt, bool universal)

## Define Documentation

#define SET | ( | x |  | ) | case x: level=#x; break

## Function Documentation

std::string @395::formattedTime | ( | std::string | fmt,
|  | bool | universal |
| ) |  |  | `[static]`

Definition at line 456 of file Message.cpp.

    00457   {
    00458     // get current time in milliseconds
    00459     longlong t = System::currentTime( System::milliSec );
    00460     int msec = static_cast<int>(t % 1000);
    00461     time_t sec = static_cast<time_t>(t / 1000);
    00462
    00463     // convert to break-down time
    00464     struct tm tms ;
    00465     if (universal) {
    00466       gmtime_r( &sec, &tms );
    00467     } else {
    00468       localtime_r( &sec, &tms );
    00469     }
    00470
    00471     // replace %f in the format string with miliseconds
    00472     std::string::size_type n = fmt.find("%f") ;
    00473     if ( n != std::string::npos ) {
    00474       char subs[4] ;
    00475       sprintf ( subs, "%03d", msec ) ;
    00476       while ( n != std::string::npos ) {
    00477         fmt.replace ( n, 2, subs ) ;
    00478         n = fmt.find("%f") ;
    00479       }
    00480     }
    00481
    00482     char buf[128] ;
    00483     strftime(buf, 128, fmt.c_str(), &tms );
    00484     return std::string( buf );
    00485   }

std::string @395::formattedTime | ( | std::string | fmt,
|  | bool | universal = `false` |
| ) |  |  | `[static]`

std::ostream& operator<< | ( | std::ostream & | stream,
|  | const Message & | msg |
| ) |  |  |

Definition at line 148 of file Message.cpp.

    00149 {
    00150   msg.makeFormattedMsg( msg.m_format );
    00151   stream << msg.m_formatted_msg;
    00152   return stream;
    00153 }

bool operator== | ( | const Message & | a,
|  | const Message & | b |
| ) |  |  |

Definition at line 174 of file Message.cpp.

    00175 {
    00176   return a.m_source == b.m_source &&
    00177     a.m_type == b.m_type &&
    00178     a.m_message == b.m_message;
    00179 }