|
@@ -724,25 +724,22 @@ DWORD CAccessAuthFSM::HandleTimeSyn(long nTimeDiff, BYTE* nSessionKey)
|
|
|
const long dwTimeDiff = nTimeDiff > 0 ? nTimeDiff : 0 - nTimeDiff;
|
|
|
const long torelateTime = m_torelateDiffSyncTimeSecs > 0 ? m_torelateDiffSyncTimeSecs : 0 - m_torelateDiffSyncTimeSecs;
|
|
|
if (torelateTime < dwTimeDiff) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("HandleTimeSyn")
|
|
|
- ("time diff is too large (%ds), sync time now", nTimeDiff);
|
|
|
-
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("HandleTimeSyn")("time diff is too large (%ds), sync time now", nTimeDiff);
|
|
|
CSmallDateTime dtServerTime((DWORD)(CSmallDateTime::GetNow()) + nTimeDiff);
|
|
|
SYSTEMTIME stServerTime = dtServerTime.ToSystemTime();
|
|
|
+ CSmallDateTime dtLocalTime((DWORD)(CSmallDateTime::GetNow()));
|
|
|
#ifdef RVC_OS_WIN
|
|
|
if (SetLocalTime(&stServerTime)) {
|
|
|
#else
|
|
|
if (set_system_time_by_sec(nTimeDiff)) {
|
|
|
#endif // RVC_OS_WIN
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sync time with server succeed, server time: [%s]", dtServerTime.ToTimeString().GetData());
|
|
|
- LogWarn(Severity_Low, Error_Debug, AccessAuthorization_UserErrorCode_Sync_Time_Succ,
|
|
|
- CSimpleStringA::Format("sync time succ: server time: [%s],diff[%ld],threshold:[%d]",
|
|
|
- dtServerTime.ToTimeString().GetData(), nTimeDiff, m_torelateDiffSyncTimeSecs));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sync time with server succeed, before local time:[%s], server time: [%s]", dtLocalTime.ToTimeString().GetData(), dtServerTime.ToTimeString().GetData());
|
|
|
+ LogWarn(Severity_Low, Error_Debug, AccessAuthorization_UserErrorCode_Sync_Time_Succ, CSimpleStringA::Format("%ld",nTimeDiff));
|
|
|
}
|
|
|
else {
|
|
|
LogWarn(Severity_Middle, Error_Unexpect, AccessAuthorization_UserErrorCode_Sync_Time_Failed,
|
|
|
- CSimpleStringA::Format("sync time failed: server time: [%s],diff[%ld],threshold:[%d](GLE=%u)",
|
|
|
- dtServerTime.ToTimeString().GetData(), nTimeDiff, m_torelateDiffSyncTimeSecs, GetLastError()));
|
|
|
+ CSimpleStringA::Format("sync time failed: local time:[%s], server time: [%s],diff[%ld],threshold:[%d](GLE=%u)",
|
|
|
+ dtLocalTime.ToTimeString().GetData(), dtServerTime.ToTimeString().GetData(), nTimeDiff, m_torelateDiffSyncTimeSecs, GetLastError()));
|
|
|
return ERR_ACCESSAUTH_SET_LOCALE_TIME;
|
|
|
}
|
|
|
}
|