osaf/services/saf/logsv/lgs/lgs_fmt.cc |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)


The milisecond token (@Ck, @Nk) does not reflect correctly. It is not
milisecond in the log record as expectation. This patch fixes the issue.

diff --git a/osaf/services/saf/logsv/lgs/lgs_fmt.cc 
b/osaf/services/saf/logsv/lgs/lgs_fmt.cc
--- a/osaf/services/saf/logsv/lgs/lgs_fmt.cc
+++ b/osaf/services/saf/logsv/lgs/lgs_fmt.cc
@@ -27,6 +27,7 @@
 /* Number of seconds per an hour/minute */
 #define SECOND_PER_HOUR  3600L
 #define SECOND_PER_MINUTE 60L
+#define SA_TIME_OFFSET 1000LL
 
 /**
  * 
@@ -535,7 +536,7 @@ static int extractCommonField(char *dest
        int characters = 0;
        char *hex_string = NULL, *hex_string_ptr = NULL;
        int no_ch = 0;
-       SaTimeT us = 0;
+       SaTimeT ms;
        long gmtOffset = 0, uGmtOffset = 0;
 
        *fmtExpPtrOffset = DEFAULT_FMT_EXP_PTR_OFFSET;
@@ -698,8 +699,8 @@ static int extractCommonField(char *dest
        case C_TIME_MILLISECOND_LETTER:
                stringSize = 4 * sizeof(char);
                /* Extract millisecond from logTimestamp */
-               us = logRecord->logTimeStamp / SA_TIME_ONE_MICROSECOND;
-               characters = snprintf(dest, dest_size, "%03lld", us % 
SA_TIME_ONE_MICROSECOND);
+               ms = (logRecord->logTimeStamp / SA_TIME_ONE_MILLISECOND) % 
SA_TIME_OFFSET;
+               characters = snprintf(dest, dest_size, "%03lld", ms);
                break;
 
        case C_TIME_TIMEZONE_LETTER:
@@ -817,7 +818,7 @@ static int extractNotificationField(char
                                    const SaBoolT *twelveHourModeFlag, const 
SaLogRecordT *logRecord)
 {
        struct tm *eventTimeData;
-       SaTimeT totalTime;
+       SaTimeT totalTime, ms;
        SaInt32T fieldSize;
        SaInt32T characters = 0;
        SaUint16T fieldSizeOffset = 0;
@@ -978,7 +979,8 @@ static int extractNotificationField(char
 
        case N_EVENT_TIME_MILLISECOND_LETTER:
                /* Extract millisecond from logTimestamp */
-               characters = snprintf(dest, dest_size, "%03lld", totalTime % 
SA_TIME_ONE_MICROSECOND);
+               ms = (logRecord->logHeader.ntfHdr.eventTime / 
SA_TIME_ONE_MILLISECOND) % SA_TIME_OFFSET;
+               characters = snprintf(dest, dest_size, "%03lld", ms);
                break;
 
        case N_EVENT_TIME_TIMEZONE_LETTER:

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to