Browse code

kemix: exported function to get timestamp

Daniel-Constantin Mierla authored on 30/01/2020 11:01:49
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@
23 23
 #include <unistd.h>
24 24
 #include <stdlib.h>
25 25
 #include <string.h>
26
+#include <time.h>
26 27
 
27 28
 #include "../../core/sr_module.h"
28 29
 #include "../../core/dprint.h"
... ...
@@ -710,6 +711,14 @@ static sr_kemi_xval_t* ki_kx_gete_duri(sip_msg_t *msg)
710 711
 	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_EMPTY);
711 712
 }
712 713
 
714
+/**
715
+ *
716
+ */
717
+static int ki_kx_get_timestamp(sip_msg_t *msg)
718
+{
719
+	return (int)time(NULL);
720
+}
721
+
713 722
 /**
714 723
  *
715 724
  */
... ...
@@ -901,7 +910,11 @@ static sr_kemi_t sr_kemi_kx_exports[] = {
901 910
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
902 911
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
903 912
 	},
904
-
913
+	{ str_init("kx"), str_init("get_timestamp"),
914
+		SR_KEMIP_INT, ki_kx_get_timestamp,
915
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
916
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
917
+	},
905 918
 
906 919
 	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
907 920
 };