File tree Expand file tree Collapse file tree 3 files changed +11
-14
lines changed
Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,6 @@ const string engine_info(bool to_uci) {
5959}
6060
6161
62- // / Convert system time to milliseconds. That's all we need.
63-
64- Time::point Time::now () {
65- sys_time_t t; system_time (&t); return time_to_msec (t);
66- }
67-
68-
6962// / Debug functions used mainly to collect run-time statistics
7063
7164static uint64_t hits[2 ], means[2 ];
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ struct Log : public std::ofstream {
4545
4646namespace Time {
4747 typedef int64_t point;
48- point now ();
48+ inline point now () { return system_time_to_msec (); }
4949}
5050
5151
Original file line number Diff line number Diff line change @@ -45,10 +45,12 @@ typedef unsigned __int64 uint64_t;
4545#ifndef _WIN32 // Linux - Unix
4646
4747# include <sys/time.h>
48- typedef timeval sys_time_t ;
4948
50- inline void system_time (sys_time_t * t ) { gettimeofday (t , NULL ); }
51- inline int64_t time_to_msec (const sys_time_t & t ) { return t .tv_sec * 1000LL + t .tv_usec / 1000 ; }
49+ inline int64_t system_time_to_msec () {
50+ timeval t ;
51+ gettimeofday (& t , NULL );
52+ return t .tv_sec * 1000LL + t .tv_usec / 1000 ;
53+ }
5254
5355# include <pthread.h>
5456typedef pthread_mutex_t Lock ;
@@ -71,10 +73,12 @@ typedef void*(*pt_start_fn)(void*);
7173#else // Windows and MinGW
7274
7375# include <sys/timeb.h>
74- typedef _timeb sys_time_t ;
7576
76- inline void system_time (sys_time_t * t ) { _ftime (t ); }
77- inline int64_t time_to_msec (const sys_time_t & t ) { return t .time * 1000LL + t .millitm ; }
77+ inline int64_t system_time_to_msec () {
78+ _timeb t ;
79+ _ftime (& t );
80+ return t .time * 1000LL + t .millitm ;
81+ }
7882
7983#ifndef NOMINMAX
8084# define NOMINMAX // disable macros min() and max()
You can’t perform that action at this time.
0 commit comments