summaryrefslogtreecommitdiffstats
path: root/collection/elapi_collection.c
diff options
context:
space:
mode:
Diffstat (limited to 'collection/elapi_collection.c')
-rw-r--r--collection/elapi_collection.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/collection/elapi_collection.c b/collection/elapi_collection.c
index 7045130..8d28eed 100644
--- a/collection/elapi_collection.c
+++ b/collection/elapi_collection.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
+#include <time.h>
#include "elapi_collection.h"
#include "elapi_debug.h"
@@ -37,7 +38,7 @@
/* Potential subjest for management with libtools */
-#define DATE_FORMAT "%+"
+#define DATE_FORMAT "%c"
#define TIME_ARRAY_SIZE 100
@@ -1334,20 +1335,23 @@ int set_timestamp(struct collection_item *ci,struct collection_item **timestr_re
int len;
struct collection_item *timestr = (struct collection_item *)(NULL);
struct collection_item *timeint = (struct collection_item *)(NULL);
+ int error = EOK;
DEBUG_STRING("set_timestamp","Entry point");
utctime = time(NULL);
localtime_r(&utctime,&time_struct);
- len = strftime(time_array, TIME_ARRAY_SIZE, date_format, &time_struct);
+ len = strftime(time_array, TIME_ARRAY_SIZE, DATE_FORMAT, &time_struct);
if(len == 0) {
DEBUG_STRING("add_time","CODING ERROR - INCREASE THE BUFFER");
return EMSGSIZE;
}
+ DEBUG_STRING("Timestamp:",time_array);
+
/* Check if we have the timestamp item already */
- error = get_item(event, TS_NAME, ELAPI_TYPE_STRING,ELAPI_TRAVERSE_IGNORE,&timestr);
+ error = get_item(ci, TS_NAME, ELAPI_TYPE_STRING,ELAPI_TRAVERSE_IGNORE,&timestr);
if(error) {
DEBUG_NUMBER("search failed with error:",error);
return error;
@@ -1366,7 +1370,7 @@ int set_timestamp(struct collection_item *ci,struct collection_item **timestr_re
}
else {
/* Add timestamp to the collection */
- error = add_str_property_with_ref(event,NULL, TS_NAME,time_array,len+1,timestr_ref);
+ error = add_str_property_with_ref(ci,NULL, TS_NAME,time_array,len+1,timestr_ref);
if(error) {
DEBUG_NUMBER("failed to add timestamp property:",error);
return error;
@@ -1374,7 +1378,7 @@ int set_timestamp(struct collection_item *ci,struct collection_item **timestr_re
}
/* Check if we have the time item already */
- error = get_item(event, T_NAME, ELAPI_TYPE_INTEGER,ELAPI_TRAVERSE_IGNORE,&timeint);
+ error = get_item(ci, T_NAME, ELAPI_TYPE_INTEGER,ELAPI_TRAVERSE_IGNORE,&timeint);
if(error) {
DEBUG_NUMBER("search failed with error:",error);
return error;
@@ -1387,7 +1391,7 @@ int set_timestamp(struct collection_item *ci,struct collection_item **timestr_re
}
else {
/* Add time to the collection */
- error = add_int_property_with_ref(event,NULL, T_NAME,utctime,timeint_ref);
+ error = add_int_property_with_ref(ci,NULL, T_NAME,utctime,timeint_ref);
if(error) {
DEBUG_NUMBER("failed to add time property:",error);
return error;