Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndris Mednis <Andris.Mednis@zabbix.com>2018-08-10 16:18:48 +0300
committerAndris Mednis <Andris.Mednis@zabbix.com>2018-08-10 16:18:48 +0300
commit4d8e4941092ad72ce92e6907e0debeb61ac5f3af (patch)
tree0c1121ad11ceca0b5c9cd8a51eaac3075543484e
parent4ba3d79b5d28ce8630d3ea949d8f81495d52d36e (diff)
...G...PS. [DEV-698] added ZBX_FS_TIME_T_T and zbx_fs_time_t_t for printing time_t-type values (issue 2)
-rw-r--r--include/zbxtypes.h2
-rw-r--r--src/zabbix_server/taskmanager/proxy_tasks.c4
-rw-r--r--src/zabbix_server/timer/timer.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index afc8d46afa1..97ec0298ebb 100644
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -154,8 +154,10 @@ typedef off_t zbx_offset_t;
#define ZBX_FS_SIZE_T ZBX_FS_UI64
#define ZBX_FS_SSIZE_T ZBX_FS_I64
+#define ZBX_FS_TIME_T_T ZBX_FS_I64
#define zbx_fs_size_t zbx_uint64_t /* use this type only in calls to printf() for formatting size_t */
#define zbx_fs_ssize_t zbx_int64_t /* use this type only in calls to printf() for formatting ssize_t */
+#define zbx_fs_time_t_t zbx_int64_t /* use this type only in calls to printf() for formatting time_t */
#ifndef S_ISREG
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
diff --git a/src/zabbix_server/taskmanager/proxy_tasks.c b/src/zabbix_server/taskmanager/proxy_tasks.c
index a804920cc5c..af1217b0662 100644
--- a/src/zabbix_server/taskmanager/proxy_tasks.c
+++ b/src/zabbix_server/taskmanager/proxy_tasks.c
@@ -58,9 +58,9 @@ void zbx_tm_get_remote_tasks(zbx_vector_ptr_t *tasks, zbx_uint64_t proxy_hostid)
" on t.taskid=cn.taskid"
" where t.status=%d"
" and t.proxy_hostid=" ZBX_FS_UI64
- " and (t.ttl=0 or t.clock+t.ttl>%ld)"
+ " and (t.ttl=0 or t.clock+t.ttl>" ZBX_FS_TIME_T_T ")"
" order by t.taskid",
- ZBX_TM_STATUS_NEW, proxy_hostid, (long int)time(NULL));
+ ZBX_TM_STATUS_NEW, proxy_hostid, (zbx_fs_time_t_t)time(NULL));
while (NULL != (row = DBfetch(result)))
{
diff --git a/src/zabbix_server/timer/timer.c b/src/zabbix_server/timer/timer.c
index ae34b3d09b4..63f66ab4737 100644
--- a/src/zabbix_server/timer/timer.c
+++ b/src/zabbix_server/timer/timer.c
@@ -286,8 +286,8 @@ static int update_maintenance_hosts(zbx_host_maintenance_t *hm, int hm_count)
if (0 == hm[i].host_maintenance_from)
{
- zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, ",maintenance_from=%ld",
- (long int)hm[i].maintenance_from);
+ zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, ",maintenance_from=" ZBX_FS_TIME_T_T,
+ (zbx_fs_time_t_t)hm[i].maintenance_from);
}
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, " where hostid=" ZBX_FS_UI64,
@@ -396,9 +396,9 @@ static int process_maintenance(void)
" from maintenances m,maintenances_windows mw,timeperiods tp"
" where m.maintenanceid=mw.maintenanceid"
" and mw.timeperiodid=tp.timeperiodid"
- " and m.active_since<=%ld"
- " and m.active_till>%ld",
- (long int)now, (long int)now);
+ " and m.active_since<=" ZBX_FS_TIME_T_T
+ " and m.active_till>" ZBX_FS_TIME_T_T,
+ (zbx_fs_time_t_t)now, (zbx_fs_time_t_t)now);
while (NULL != (row = DBfetch(result)))
{