From f371621cd376520256c0b26ca02b8ec5f652dc7e Mon Sep 17 00:00:00 2001 From: BlueCrescent Date: Mon, 12 Feb 2024 18:23:41 +0900 Subject: [PATCH] =?UTF-8?q?1=E5=88=86=E3=81=9A=E3=82=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JJYReceiver.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/JJYReceiver.cpp b/src/JJYReceiver.cpp index 7a35068..f791e46 100644 --- a/src/JJYReceiver.cpp +++ b/src/JJYReceiver.cpp @@ -84,11 +84,15 @@ bool JJYReceiver::timeCheck(){ jjydata[compare[i][0]].bits.hour == jjydata[compare[i][1]].bits.hour && min1 == min2) { + if(min1 > min2){ + last_jjydata = jjydata[compare[i][0]]; + }else{ last_jjydata = jjydata[compare[i][1]]; - timeavailable[compare[i][1]] = 1; - state = TIMEVALID; - stop(); - return true; + } + timeavailable[compare[i][1]] = 1; + state = TIMEVALID; + stop(); + return true; } } return false; @@ -106,7 +110,7 @@ time_t JJYReceiver::get_time(uint8_t index) { yday = ((((jjydata[index].bits.doyh >> 5) & 0x0002)) * 100) + (((jjydata[index].bits.doyh & 0x000f)) * 10) + jjydata[index].bits.doyl; calculateDate(year, yday ,(uint8_t*) &timeinfo.tm_mon,(uint8_t*) &timeinfo.tm_mday); timeinfo.tm_hour = ((jjydata[index].bits.hour >> 5) & 0x3) * 10 + (jjydata[index].bits.hour & 0x0f) ; // 時 - timeinfo.tm_min = ((jjydata[index].bits.min >> 5) & 0x7) * 10 + (jjydata[index].bits.min & 0x0f) + 2; // 分 + timeinfo.tm_min = ((jjydata[index].bits.min >> 5) & 0x7) * 10 + (jjydata[index].bits.min & 0x0f) + 1; // 分 temptime = mktime(&timeinfo); return temptime; }