统一跨平台时间函数接口。

This commit is contained in:
xinyang
2019-07-31 14:51:01 +08:00
parent 01882b97c6
commit 98bc5ef95b
23 changed files with 87 additions and 95 deletions

View File

@@ -19,7 +19,7 @@ void Energy::judgeShootInWorld() {
// is_predicting = false;
// is_guessing = true;
// start_guess = true;
// gettimeofday(&time_start_guess, NULL);
// getsystime(time_start_guess);
LOGM(STR_CTR(WORD_LIGHT_RED, "Start Guessing!"));
} else
shoot = 2;
@@ -35,7 +35,7 @@ void Energy::judgeShootInGimbal() {
// is_predicting = false;
// is_guessing = true;
// start_guess = true;
// gettimeofday(&time_start_guess, NULL);
// getsystime(time_start_guess);
// LOGM(STR_CTR(WORD_LIGHT_RED, "Start Guessing!"));
} else
shoot = 2;

View File

@@ -14,8 +14,7 @@ using namespace cv;
// 此函数用于判断guess模式是否超时
// ---------------------------------------------------------------------------------------------------------------------
bool Energy::isGuessingTimeout() {
timeval cur_time;
gettimeofday(&cur_time, NULL);
return (cur_time.tv_sec - time_start_guess.tv_sec) * 1000.0 +
(cur_time.tv_usec - time_start_guess.tv_usec) / 1000.0 > 1000;
systime cur_time;
getsystime(cur_time);
return getTimeIntervalms(cur_time, time_start_guess) > 1000;
};

View File

@@ -4,8 +4,7 @@
#include "energy/energy.h"
#include "log.h"
#include "config/setconfig.h"
#include "options/options.h"
#include <sys/time.h>
#include "options.h"
using namespace std;
using namespace cv;