Replace SDL_GetTicks with boost.datetime
This commit is contained in:
parent
5d49489502
commit
78d51032e4
2 changed files with 7 additions and 7 deletions
|
@ -22,8 +22,6 @@
|
|||
#include "game_errors.hpp"
|
||||
#include "global.hpp"
|
||||
|
||||
#include "SDL_timer.h"
|
||||
|
||||
#include "log.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
@ -206,14 +204,14 @@ void scope_logger::do_log_entry(log_domain const &domain, const std::string& str
|
|||
{
|
||||
output_ = &debug(domain, false, true);
|
||||
str_ = str;
|
||||
ticks_ = SDL_GetTicks();
|
||||
ticks_ = boost::posix_time::microsec_clock::local_time();
|
||||
(*output_) << "{ BEGIN: " << str_ << "\n";
|
||||
++indent;
|
||||
}
|
||||
|
||||
void scope_logger::do_log_exit()
|
||||
{
|
||||
const int ticks = SDL_GetTicks() - ticks_;
|
||||
const long ticks = (boost::posix_time::microsec_clock::local_time() - ticks_).total_milliseconds();
|
||||
--indent;
|
||||
do_indent();
|
||||
if (timestamp) (*output_) << get_timestamp(time(NULL));
|
||||
|
|
|
@ -56,6 +56,10 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
||||
using boost::posix_time::ptime;
|
||||
|
||||
namespace lg {
|
||||
|
||||
/**
|
||||
|
@ -140,19 +144,17 @@ extern log_domain general;
|
|||
|
||||
class scope_logger
|
||||
{
|
||||
int ticks_;
|
||||
ptime ticks_;
|
||||
std::ostream *output_;
|
||||
std::string str_;
|
||||
public:
|
||||
scope_logger(log_domain const &domain, const char* str) :
|
||||
ticks_(0),
|
||||
output_(NULL),
|
||||
str_()
|
||||
{
|
||||
if (!debug.dont_log(domain)) do_log_entry(domain, str);
|
||||
}
|
||||
scope_logger(log_domain const &domain, const std::string& str) :
|
||||
ticks_(0),
|
||||
output_(NULL),
|
||||
str_()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue