41 lines
807 B
C++
41 lines
807 B
C++
#ifndef WEB_FREECAD_BASE_CONSOLE_H
|
|
#define WEB_FREECAD_BASE_CONSOLE_H
|
|
|
|
#include <chrono>
|
|
|
|
namespace Base
|
|
{
|
|
class TimeElapsed: public std::chrono::time_point<std::chrono::steady_clock>
|
|
{
|
|
public:
|
|
TimeElapsed()
|
|
: std::chrono::time_point<std::chrono::steady_clock>(std::chrono::steady_clock::now())
|
|
{}
|
|
|
|
static float diffTimeF(const TimeElapsed& start, const TimeElapsed& end = TimeElapsed())
|
|
{
|
|
return std::chrono::duration<float>(end - start).count();
|
|
}
|
|
};
|
|
|
|
class ConsoleSingleton
|
|
{
|
|
public:
|
|
template<typename... Args>
|
|
void log(const char*, Args&&...)
|
|
{}
|
|
|
|
template<typename... Args>
|
|
void warning(const char*, Args&&...)
|
|
{}
|
|
};
|
|
|
|
inline ConsoleSingleton& Console()
|
|
{
|
|
static ConsoleSingleton console;
|
|
return console;
|
|
}
|
|
} // namespace Base
|
|
|
|
#endif
|