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.

65 lines
1.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "protocolEuropeanGeneral.h"
  2. #include "../../alg/generic/md5.h"
  3. CSTR defenderStatusMode[] = {
  4. "OPERATIONAL",
  5. "DEGRADED"
  6. };
  7. CSTR defenderFaultCode[] = {
  8. "Critical",
  9. "Warning",
  10. "Info"
  11. };
  12. CSTR defenderCategories[] = {
  13. DFSL_CATEGORY_ERROR,
  14. DFSL_CATEGORY_STATUS,
  15. DFSL_CATEGORY_ALARM_2D,
  16. DFSL_CATEGORY_ALARM_3D
  17. };
  18. CSTR defenderTypeDescription[] = {
  19. "Fault Event",
  20. "Status Message",
  21. "Target Detection Event",
  22. "Target Detection Event"
  23. };
  24. CSTR defenderTypeSeverity[] = {
  25. "very-low",
  26. "low",
  27. "medium",
  28. "high",
  29. "very-high"
  30. };
  31. /**
  32. * number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC
  33. */
  34. bool correctSHDTime( int diff ){
  35. #ifdef __linux__
  36. struct timeval tData;
  37. struct timezone tTZ;
  38. tTZ.tz_minuteswest = 0;
  39. tTZ.tz_dsttime = 0;
  40. if( gettimeofday( &tData, &tTZ ) == -1 ){
  41. return false;
  42. } else {
  43. tData.tv_sec += diff / 1000;
  44. tData.tv_usec += ( diff * 1000 ) % 1000000;
  45. };
  46. if( settimeofday( &tData, &tTZ ) == -1 ){
  47. return false;
  48. };
  49. #else
  50. unsigned __int64 tMilliseconds;
  51. SYSTEMTIME Ztime;
  52. GetSystemTime(&Ztime);
  53. SystemTimeToFileTime( &Ztime, (FILETIME*) &tMilliseconds );
  54. tMilliseconds += diff * 10000;
  55. FileTimeToSystemTime( (FILETIME*) &tMilliseconds, &Ztime );
  56. if( 0 == SetSystemTime(&Ztime) ) return false;
  57. #endif
  58. return true;
  59. };