summaryrefslogtreecommitdiff
path: root/comms/asterisk18/patches/patch-cdr_cdr__pgsql.c
blob: 1a68eb0d4cb9860fbc59bf3c2257f271e3a95ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$NetBSD: patch-cdr_cdr__pgsql.c,v 1.1.1.1 2021/06/13 07:47:18 jnemeth Exp $

--- cdr/cdr_pgsql.c.orig	2016-09-30 20:36:17.000000000 +0000
+++ cdr/cdr_pgsql.c
@@ -270,7 +270,7 @@ static int pgsql_log(struct ast_cdr *cdr
 			if (strcmp(cur->name, "start") == 0 || strcmp(cur->name, "calldate") == 0) {
 				if (strncmp(cur->type, "int", 3) == 0) {
 					LENGTHEN_BUF2(13);
-					ast_str_append(&sql2, 0, "%s%ld", separator, (long) cdr->start.tv_sec);
+					ast_str_append(&sql2, 0, "%s%jd", separator, (intmax_t) cdr->start.tv_sec);
 				} else if (strncmp(cur->type, "float", 5) == 0) {
 					LENGTHEN_BUF2(31);
 					ast_str_append(&sql2, 0, "%s%f", separator, (double)cdr->start.tv_sec + (double)cdr->start.tv_usec / 1000000.0);
@@ -284,7 +284,7 @@ static int pgsql_log(struct ast_cdr *cdr
 			} else if (strcmp(cur->name, "answer") == 0) {
 				if (strncmp(cur->type, "int", 3) == 0) {
 					LENGTHEN_BUF2(13);
-					ast_str_append(&sql2, 0, "%s%ld", separator, (long) cdr->answer.tv_sec);
+					ast_str_append(&sql2, 0, "%s%jd", separator, (intmax_t) cdr->answer.tv_sec);
 				} else if (strncmp(cur->type, "float", 5) == 0) {
 					LENGTHEN_BUF2(31);
 					ast_str_append(&sql2, 0, "%s%f", separator, (double)cdr->answer.tv_sec + (double)cdr->answer.tv_usec / 1000000.0);
@@ -298,7 +298,7 @@ static int pgsql_log(struct ast_cdr *cdr
 			} else if (strcmp(cur->name, "end") == 0) {
 				if (strncmp(cur->type, "int", 3) == 0) {
 					LENGTHEN_BUF2(13);
-					ast_str_append(&sql2, 0, "%s%ld", separator, (long) cdr->end.tv_sec);
+					ast_str_append(&sql2, 0, "%s%jd", separator, (intmax_t) cdr->end.tv_sec);
 				} else if (strncmp(cur->type, "float", 5) == 0) {
 					LENGTHEN_BUF2(31);
 					ast_str_append(&sql2, 0, "%s%f", separator, (double)cdr->end.tv_sec + (double)cdr->end.tv_usec / 1000000.0);