From 2687d0010ca0ec691235a69c9da021719b61e8cd Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 6 Jun 2008 17:33:58 +0200 Subject: added new property replacer option "time-subseconds" enables to query just the subsecond part of a high-precision timestamp --- runtime/msg.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'runtime/msg.c') diff --git a/runtime/msg.c b/runtime/msg.c index f195d3bd..e2d0b54c 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -279,6 +279,8 @@ CODESTARTobjDestruct(msg) free(pThis->pszRcvdAt3164); if(pThis->pszRcvdAt3339 != NULL) free(pThis->pszRcvdAt3339); + if(pThis->pszRcvdAt_SecFrac != NULL) + free(pThis->pszRcvdAt_SecFrac); if(pThis->pszRcvdAt_MySQL != NULL) free(pThis->pszRcvdAt_MySQL); if(pThis->pszRcvdAt_PgSQL != NULL) @@ -287,6 +289,8 @@ CODESTARTobjDestruct(msg) free(pThis->pszTIMESTAMP3164); if(pThis->pszTIMESTAMP3339 != NULL) free(pThis->pszTIMESTAMP3339); + if(pThis->pszTIMESTAMP_SecFrac != NULL) + free(pThis->pszTIMESTAMP_SecFrac); if(pThis->pszTIMESTAMP_MySQL != NULL) free(pThis->pszTIMESTAMP_MySQL); if(pThis->pszTIMESTAMP_PgSQL != NULL) @@ -738,6 +742,17 @@ char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt) } MsgUnlock(pM); return(pM->pszTIMESTAMP3339); + case tplFmtSecFrac: + MsgLock(pM); + if(pM->pszTIMESTAMP_SecFrac == NULL) { + if((pM->pszTIMESTAMP_SecFrac = malloc(10)) == NULL) { + MsgUnlock(pM); + return ""; /* TODO: check this: can it cause a free() of constant memory?) */ + } + datetime.formatTimestampSecFrac(&pM->tTIMESTAMP, pM->pszTIMESTAMP3339, 10); + } + MsgUnlock(pM); + return(pM->pszTIMESTAMP_SecFrac); } return "INVALID eFmt OPTION!"; } @@ -803,6 +818,17 @@ char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt) } MsgUnlock(pM); return(pM->pszRcvdAt3339); + case tplFmtSecFrac: + MsgLock(pM); + if(pM->pszRcvdAt_SecFrac == NULL) { + if((pM->pszRcvdAt_SecFrac = malloc(10)) == NULL) { + MsgUnlock(pM); + return ""; /* TODO: check this: can it cause a free() of constant memory?) */ + } + datetime.formatTimestampSecFrac(&pM->tRcvdAt, pM->pszRcvdAt_SecFrac, 10); + } + MsgUnlock(pM); + return(pM->pszRcvdAt_SecFrac); } return "INVALID eFmt OPTION!"; } -- cgit v1.2.3