From: Marco Costalba Date: Sun, 2 Sep 2012 14:39:01 +0000 (+0200) Subject: Rename current_time() to now() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=5900ab76a05b96f902fd3fc2794670916a7cb0ea Rename current_time() to now() Follow C++11 naming conventions. No functional change. --- diff --git a/src/benchmark.cpp b/src/benchmark.cpp index 9dc103ed..5fcaa887 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -111,7 +111,7 @@ void benchmark(const Position& current, istream& is) { int64_t nodes = 0; Search::StateStackPtr st; - Time time = Time::current_time(); + Time time = Time::now(); for (size_t i = 0; i < fens.size(); i++) { diff --git a/src/book.cpp b/src/book.cpp index ba56e777..cdf1bd91 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -340,7 +340,7 @@ namespace { Book::Book() { - for (int i = Time::current_time().msec() % 10000; i > 0; i--) + for (int i = Time::now().msec() % 10000; i > 0; i--) RKiss.rand(); // Make random number generation less deterministic } diff --git a/src/misc.cpp b/src/misc.cpp index ababdbc1..75a294a1 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -201,7 +201,7 @@ void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) { int tm = msec; #else timespec ts, *tm = &ts; - uint64_t ms = Time::current_time().msec() + msec; + uint64_t ms = Time::now().msec() + msec; ts.tv_sec = ms / 1000; ts.tv_nsec = (ms % 1000) * 1000000LL; diff --git a/src/misc.h b/src/misc.h index 1241503f..02ae8b38 100644 --- a/src/misc.h +++ b/src/misc.h @@ -46,9 +46,9 @@ struct Log : public std::ofstream { struct Time { int64_t msec() const { return time_to_msec(t); } - int elapsed() const { return int(current_time().msec() - msec()); } + int elapsed() const { return int(now().msec() - msec()); } - static Time current_time() { Time t; system_time(&t.t); return t; } + static Time now() { Time t; system_time(&t.t); return t; } private: sys_time_t t; diff --git a/src/search.cpp b/src/search.cpp index 53a99f66..827f0747 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1494,7 +1494,7 @@ split_point_start: // At split points actual search starts from here static RKISS rk; // PRNG sequence should be not deterministic - for (int i = Time::current_time().msec() % 50; i > 0; i--) + for (int i = Time::now().msec() % 50; i > 0; i--) rk.rand(); // RootMoves are already sorted by score in descending order @@ -1749,11 +1749,11 @@ void Thread::idle_loop() { void check_time() { - static Time lastInfoTime = Time::current_time(); + static Time lastInfoTime = Time::now(); if (lastInfoTime.elapsed() >= 1000) { - lastInfoTime = Time::current_time(); + lastInfoTime = Time::now(); dbg_print(); } diff --git a/src/thread.cpp b/src/thread.cpp index d9fa9c51..8d522fa2 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -417,7 +417,7 @@ void ThreadPool::start_searching(const Position& pos, const LimitsType& limits, const std::vector& searchMoves, StateStackPtr& states) { wait_for_search_finished(); - SearchTime = Time::current_time(); // As early as possible + SearchTime = Time::now(); // As early as possible Signals.stopOnPonderhit = Signals.firstRootMove = false; Signals.stop = Signals.failedLowAtRoot = false;