From 39c3b3e3c2cd3a5ffea6f32b3f27a6a612a72a85 Mon Sep 17 00:00:00 2001 From: wanpiqiu123 <779893878@qq.com> Date: Mon, 22 Jul 2019 09:43:33 +0800 Subject: [PATCH] fix bug --- others/src/camera/camera_wrapper.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/others/src/camera/camera_wrapper.cpp b/others/src/camera/camera_wrapper.cpp index 614506d..f06ee78 100644 --- a/others/src/camera/camera_wrapper.cpp +++ b/others/src/camera/camera_wrapper.cpp @@ -80,11 +80,13 @@ bool CameraWrapper::init() { #ifndef WITH_TIME_BASED_CAMERA_GAIN CameraSetAnalogGain(h_camera, ARMOR_CAMERA_GAIN); #else - #include + +#include + timeval tv; int gain; gettimeofday(&tv, nullptr); - float hour = tv.tv_sec / 3600.0; + float hour = (tv.tv_sec % (3600 * 24)) / 3600.0; if (6 <= hour && hour < 10) { gain = 20; } else if (10 <= hour && hour < 16) {