You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
1.2 KiB

#include "protocolEuropeanGeneral.h"
#include "../../alg/generic/md5.h"
CSTR defenderStatusMode[] = {"OPERATIONAL", "DEGRADED"};
CSTR defenderFaultCode[] = {"Critical", "Warning", "Info"};
CSTR defenderCategories[] = {DFSL_CATEGORY_ERROR, DFSL_CATEGORY_STATUS, DFSL_CATEGORY_ALARM_2D, DFSL_CATEGORY_ALARM_3D};
CSTR defenderTypeDescription[] = {"Fault Event", "Status Message", "Target Detection Event", "Target Detection Event"};
CSTR defenderTypeSeverity[] = {"very-low", "low", "medium", "high", "very-high"};
/**
* number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC
*/
bool correctSHDTime(int diff)
{
#ifdef __linux__
struct timeval tData;
struct timezone tTZ;
tTZ.tz_minuteswest = 0;
tTZ.tz_dsttime = 0;
if (gettimeofday(&tData, &tTZ) == -1)
{
return false;
}
else
{
tData.tv_sec += diff / 1000;
tData.tv_usec += (diff * 1000) % 1000000;
};
if (settimeofday(&tData, &tTZ) == -1)
{
return false;
};
#else
unsigned __int64 tMilliseconds;
SYSTEMTIME Ztime;
GetSystemTime(&Ztime);
SystemTimeToFileTime(&Ztime, (FILETIME *) &tMilliseconds);
tMilliseconds += diff * 10000;
FileTimeToSystemTime((FILETIME *) &tMilliseconds, &Ztime);
if (0 == SetSystemTime(&Ztime))
{
return false;
}
#endif
return true;
}