调整时间获取方法

This commit is contained in:
gb 2022-11-08 11:22:21 +08:00
parent 1b54abb175
commit e687b1dc93
3 changed files with 13 additions and 11 deletions

View File

@ -19,4 +19,6 @@ EXPORTS
hg_scanner_err_name
hg_scanner_err_description
hg_scanner_log_is_enable
hg_scanner_log
hg_scanner_log
get_current_time
get_current_time_w

View File

@ -2846,12 +2846,10 @@ void init_log(void)
fwrite(&bom, sizeof(bom), 1, g_file_);
}
time_t now = time(NULL);
struct tm* t = localtime(&now);
wchar_t ts[128] = { 0 };
wchar_t ts[128] = { 0 }, now[40] = { 0 };
swprintf_s(ts, _countof(ts) - 1, L"==================%04d-%02d-%02d %02d:%02d:%02d==================\r\n"
, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
get_current_time_w(now);
swprintf_s(ts, _countof(ts) - 1, L"==================%s==================\r\n", now);
fwrite(ts, 2, lstrlenW(ts), g_file_);
}
}
@ -2877,12 +2875,10 @@ void log(const wchar_t* info)
if (g_file_)
{
unsigned short bom = 0x0feff;
time_t now = time(NULL);
struct tm* t = localtime(&now);
wchar_t ts[128] = { 0 };
wchar_t ts[128] = { 0 }, now[40] = { 0 };
swprintf_s(ts, _countof(ts) - 1, L"==================%04d-%02d-%02d %02d:%02d:%02d (Truncated when size > 10MB) ==================\r\n"
, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
get_current_time_w(now);
swprintf_s(ts, _countof(ts) - 1, L"==================%s (Truncated when size > 10MB) ==================\r\n", now);
fwrite(&bom, sizeof(bom), 1, g_file_);
fwrite(ts, 2, lstrlenW(ts), g_file_);
}

View File

@ -1333,7 +1333,11 @@ Result huagao_ds::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, v
// we can override almost anything from SourceFromThis, even the top-most source instance call
//FileTools::write_log("D:\\1.txt", "call:datagroup-"+to_string((int)dg)+"dat-"+to_string(int(dat))+"msg-"+to_string(int(msg)));
if (dat == Dat::ImageNativeXfer && state() == DsState::Enabled) // 云阅卷扫描端不等状态改变,直接取图,此处设置一次状态 2022-11-07
{
load_sane_util::log_info(L"APP SEQ ERROR: fetch image while status in 'Enabled' yet! we change it to 'XferReady' manually.\r\n", 0);
notifyXferReady();
}
return Base::call(origin, dg, dat, msg, data);
}