diff --git a/Distro/pp_cc/rootCA.srl b/Distro/pp_cc/rootCA.srl index 94be879e..6c5425df 100644 --- a/Distro/pp_cc/rootCA.srl +++ b/Distro/pp_cc/rootCA.srl @@ -1 +1 @@ -58EF3FD140413B2CA6B811223EDBB6B0CB926FAC +58EF3FD140413B2CA6B811223EDBB6B0CB926FAD diff --git a/lib/components/base/basicEvent.cpp b/lib/components/base/basicEvent.cpp index 76ab7cb4..a4d9e212 100644 --- a/lib/components/base/basicEvent.cpp +++ b/lib/components/base/basicEvent.cpp @@ -20,9 +20,10 @@ void utilizeBasicEvent(EVENT_CONTAINER & Evt) { if (Evt.m_pHumanReadableMsg != NULL) { - delete(Evt.m_pHumanReadableMsg); + free( Evt.m_pHumanReadableMsg ); // The mem is allocated by malloc!! + Evt.m_pHumanReadableMsg = NULL; }; - Evt.m_pHumanReadableMsg = NULL; + if (Evt.m_pEvtData != NULL) { switch (Evt.m_eType) @@ -65,8 +66,9 @@ void utilizeBasicEvent(EVENT_CONTAINER *& Evt) } if (Evt->m_pHumanReadableMsg != NULL) { - delete(Evt->m_pHumanReadableMsg); - }; + free( Evt->m_pHumanReadableMsg ); // The mem is allocated by malloc!! + Evt->m_pHumanReadableMsg = NULL; + }; if (Evt->m_pEvtData != NULL) { switch (Evt->m_eType) @@ -112,13 +114,13 @@ EVENT_CONTAINER * createBasicEvent(uint64_t SRC, basicEventClassID Class, basicE if (tss == 0) { time_t t = time(NULL); - tEvent->sTS = *localtime(&t); + localtime_r( &t, &tEvent->sTS );// MT safe tEvent->m_UMSTS = getMilliseconds(); } else { time_t t = (time_t) tss; - tEvent->sTS = *localtime(&t); + localtime_r( &t, &tEvent->sTS );// MT safe tEvent->m_UMSTS = tss; tEvent->m_UMSTS = tEvent->m_UMSTS * 1000 + tms; }; @@ -166,13 +168,13 @@ EVENT_CONTAINER * createBasicTargetedEvent(uint64_t SRC, uint64_t DST, basicEven if (tss == 0) { time_t t = time(NULL); - tEvent->sTS = *localtime(&t); + localtime_r( &t, &tEvent->sTS );// MT safe tEvent->m_UMSTS = getMilliseconds(); } else { time_t t = (time_t) tss; - tEvent->sTS = *localtime(&t); + localtime_r( &t, &tEvent->sTS );// MT safe tEvent->m_UMSTS = tss; tEvent->m_UMSTS = tEvent->m_UMSTS * 1000 + tms; }; diff --git a/lib/components/base/basicFunctionality.cpp b/lib/components/base/basicFunctionality.cpp index 6d6df3b3..8142f89d 100644 --- a/lib/components/base/basicFunctionality.cpp +++ b/lib/components/base/basicFunctionality.cpp @@ -780,21 +780,21 @@ uint64_t getMilliseconds(void) struct timezone tTZ; tTZ.tz_minuteswest = 0; tTZ.tz_dsttime = 0; - if (gettimeofday(&tData, &tTZ) == -1) - { + if( gettimeofday( &tData, &tTZ ) == -1 ){ tMilliseconds = (uint64_t) 0; - #ifdef DEBUG - URGENT_LOG("EbioMat'!"); - #endif - } - else - { - tMilliseconds = (uint64_t) tData.tv_sec; +#ifdef DEBUG + URGENT_LOG("gettimeofday error!"); +#endif + } else { + tMilliseconds = (uint64_t) ( tData.tv_sec - ( tTZ.tz_minuteswest * 60 ) ); //Correcting TZ shift tMilliseconds = (tMilliseconds * 1000); tMilliseconds += (uint64_t) (tData.tv_usec / 1000); - // URGENT_LOG("MilSecCollected!"); }; -#else + return tMilliseconds; +} + +#else // !__linux__ + #include unsigned __int64 getMilliseconds(void) { @@ -804,9 +804,10 @@ unsigned __int64 getMilliseconds(void) tMilliseconds = (uint32_t) std::time(NULL); tMilliseconds *= 1000; tMilliseconds += time.wMilliseconds; -#endif - return tMilliseconds; + return tMilliseconds; } +#endif + #ifdef __linux__ diff --git a/lib/components/base/basicLogCollection.cpp b/lib/components/base/basicLogCollection.cpp index 61329526..41aee956 100644 --- a/lib/components/base/basicLogCollection.cpp +++ b/lib/components/base/basicLogCollection.cpp @@ -77,16 +77,20 @@ void basicLogCollection::Log(const char * Mod, void * ptr, _LOG_LEVEL Level, CST { time_t LocalTime; time(&LocalTime); -#ifndef __linux__ +#ifdef USE_LOCAL_TIME_IN_THE_LOG + +#else + #ifndef __linux__ tm * gmt_time = NULL; gmt_time = gmtime(&LocalTime); -#else + #else tm gmtt; tm * gmt_time = &gmtt; - if (gmtime_r(&LocalTime, &gmtt) == NULL) + if (gmtime_r(&LocalTime, gmt_time) == NULL) { return; } + #endif #endif switch (m_bLogSettings) { diff --git a/lib/components/base/basicLogCollection.h b/lib/components/base/basicLogCollection.h index 4463f303..78c6adcd 100644 --- a/lib/components/base/basicLogCollection.h +++ b/lib/components/base/basicLogCollection.h @@ -4,6 +4,8 @@ #include "basicLoggingService.h" #include "basicMutex.h" +#define USE_LOCAL_TIME_IN_THE_LOG + #include typedef enum EE_LOG_LEVEL