解决代码冲突
This commit is contained in:
parent
1d3b65906f
commit
61d1732b97
@ -77,21 +77,25 @@ std::string JsonData::JsonCmd_Cgi_02(Param_02 ¶m) {
|
||||
if (0 == param.mMode) {
|
||||
jsonVal["type"] = "SET";
|
||||
if (param.mMode == 0) { //本地校时
|
||||
unsigned long set_timestamp = (unsigned long)param.mTimeStamp;
|
||||
char localtimestamp[32] = {0};
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
std::string current_system_timestamp = std::string(localtimestamp);
|
||||
unsigned long current_timestamp = boost::lexical_cast<unsigned long>(current_system_timestamp);
|
||||
unsigned long diff_seconds = abs(current_timestamp - set_timestamp);
|
||||
if (diff_seconds > 5) {
|
||||
SetTime((unsigned long)param.mTimeStamp);
|
||||
mssleep(200);
|
||||
system("hwclock -w");
|
||||
} else {
|
||||
zlog_warn(zct, "diff seconds:%ld lesser than 5, not to modify", diff_seconds);
|
||||
}
|
||||
} else if (param.mMode == 1) { //与服务器校时
|
||||
char buf[256] = {0};
|
||||
sprintf(buf, "{\"dataNodeGatewayNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", GlobalConfig::MacAddr_G.c_str());
|
||||
std::string str = std::string(buf);
|
||||
data_publish(str.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str());
|
||||
}
|
||||
} else if (1 == param.mMode) {
|
||||
char localtimestamp[32] = {0};
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
std::string nowTimetamp = std::string(localtimestamp);
|
||||
jsonVal["type"] = "GET";
|
||||
jsonVal["timeStamp"] = atoi(nowTimetamp.c_str());
|
||||
}
|
||||
return show_value_.write(jsonVal);
|
||||
}
|
||||
|
||||
8
main.cpp
8
main.cpp
@ -9,7 +9,6 @@
|
||||
#include <sys/wait.h>
|
||||
#include <boost/thread.hpp>
|
||||
#include <zlog.h>
|
||||
#include "minilzo/minilzo.h"
|
||||
#include "platform/platform_init.hpp"
|
||||
#include "common/common_func.hpp"
|
||||
#include "common/global.hpp"
|
||||
@ -18,6 +17,7 @@
|
||||
#include "utility/aes.h"
|
||||
#include "dbaccess/sql_db.hpp"
|
||||
#include "uart/uart.hpp"
|
||||
#include "minilzo/minilzo.h"
|
||||
|
||||
extern std::vector<RecvData> g_VecWaveDataX;
|
||||
extern std::vector<RecvData> g_VecWaveDataY;
|
||||
@ -27,7 +27,7 @@ zlog_category_t *zct = NULL;
|
||||
zlog_category_t *zbt = NULL;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int rc = zlog_init("/opt/wlg.conf");
|
||||
int rc = zlog_init("/opt/configenv/wlg.conf");
|
||||
if (rc) {
|
||||
printf("init failed\n");
|
||||
return -1;
|
||||
@ -41,8 +41,8 @@ int main(int argc, char *argv[]) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
zlog_info(zbt, " Firmware compile time:%s %s,version %s\n", __DATE__, __TIME__, GlobalConfig::Version.c_str());
|
||||
zlog_info(zbt, "####CIDNSOFT start####\n");
|
||||
zlog_info(zbt, " Firmware compile time:%s %s,version %s", __DATE__, __TIME__, GlobalConfig::Version.c_str());
|
||||
zlog_info(zbt, "####CIDNSOFT start####");
|
||||
|
||||
g_VecWaveDataX.reserve(1000);
|
||||
g_VecWaveDataY.reserve(1000);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user