提交 d0a51599 编写于 作者: D dongdaxiang

Merge branch 'add_timer' of https://github.com/guru4elephant/Paddle into add_timer

test=develop
...@@ -17,6 +17,27 @@ limitations under the License. */ ...@@ -17,6 +17,27 @@ limitations under the License. */
namespace paddle { namespace paddle {
namespace platform { namespace platform {
#if defined _WIN32
static int gettimeofday(struct timeval *tp, void *tzp) {
time_t clock;
struct tm tm;
SYSTEMTIME wtm;
GetLocalTime(&wtm);
tm.tm_year = wtm.wYear - 1900;
tm.tm_mon = wtm.wMonth - 1;
tm.tm_mday = wtm.wDay;
tm.tm_hour = wtm.wHour;
tm.tm_min = wtm.wMinute;
tm.tm_sec = wtm.wSecond;
tm.tm_isdst = -1;
clock = mktime(&tm);
tp->tv_sec = clock;
tp->tv_usec = wtm.wMilliseconds * 1000;
return (0);
}
#endif
void Timer::Reset() { void Timer::Reset() {
_start.tv_sec = 0; _start.tv_sec = 0;
_start.tv_usec = 0; _start.tv_usec = 0;
......
...@@ -14,7 +14,16 @@ limitations under the License. */ ...@@ -14,7 +14,16 @@ limitations under the License. */
#pragma once #pragma once
#include <stdlib.h> #include <stdlib.h>
#if defined __APPLE__
#include <time.h>
#else
#include <time.h>
#if defined _WIN32
#include <windows.h>
#else
#include <sys/time.h> #include <sys/time.h>
#endif
#endif
namespace paddle { namespace paddle {
namespace platform { namespace platform {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册