V6.7.4 追加更新

This commit is contained in:
2026-07-20 09:21:44 +08:00
parent 6425b11a96
commit e90e80000f
25 changed files with 2830 additions and 2764 deletions
+22 -3
View File
@@ -2,6 +2,8 @@
#include "ui_MainInstruction.h"
#include <QMessageBox>
#include <QDebug>
#include <cerrno>
#include <cstring>
#include "DlgRFIDConfig.h"
#include "runtimectrl.h"
#include "DlgCanvasHeightEditor.h"
@@ -210,7 +212,7 @@ void MainInstruction::on_btn_time_clicked()
#include <time.h>
void m_adjustdate(int year, int mon, int mday, int hour, int min, int sec) {
time_t t;
struct tm nowtime;
struct tm nowtime = {};
nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second)
nowtime.tm_min = min; // Minutes.[0-59]
nowtime.tm_hour = hour; // Hours. [0-23]
@@ -220,11 +222,28 @@ void m_adjustdate(int year, int mon, int mday, int hour, int min, int sec) {
nowtime.tm_isdst = -1; // DST.[-1/0/1]
t = mktime(&nowtime);
#if __GLIBC_MINOR__ >= 31
// GLibc 版本 大于等于 2.31时使用新API
#if (__GLIBC_MINOR__ >= 31 && __GLIBC__ == 2) || (__GLIBC__ > 2)
if (t == static_cast<time_t>(-1)) {
qWarning() << "mktime failed, errno:" << errno << QString::fromLocal8Bit(std::strerror(errno));
return;
}
struct timespec res;
res.tv_nsec = 0;
res.tv_sec = t;
clock_settime(CLOCK_REALTIME, &res);
auto r = clock_settime(CLOCK_REALTIME, &res);
if (r != 0) {
qWarning() << "clock_settime failed, errno:" << errno << QString::fromLocal8Bit(std::strerror(errno));
} else {
qInfo() << "clock_settime success";
}
#else
if (t == static_cast<time_t>(-1)) {
qWarning() << "mktime failed, errno:" << errno << QString::fromLocal8Bit(std::strerror(errno));
return;
}
stime(&t);
#endif
}