Source
if (NULL != jp && SUCCEED == zbx_json_value_by_name(jp, ZBX_PROTO_TAG_VERSION, value, sizeof(value), NULL))
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
void zbx_calc_timestamp(const char *line, int *timestamp, const char *format)
{
int hh, mm, ss, yyyy, dd, MM;
int hhc = 0, mmc = 0, yyyyc = 0, ddc = 0, MMc = 0;
int i, num;
struct tm tm;
time_t t;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
hh = mm = ss = yyyy = dd = MM = 0;
for (i = 0; '\0' != format[i] && '\0' != line[i]; i++)
{
if (0 == isdigit(line[i]))
continue;
num = (int)line[i] - 48;
switch ((char)format[i])
{
case 'h':
hh = 10 * hh + num;
hhc++;
break;
case 'm':
mm = 10 * mm + num;
mmc++;
break;
case 's':
ss = 10 * ss + num;
break;
case 'y':
yyyy = 10 * yyyy + num;
yyyyc++;
break;
case 'd':
dd = 10 * dd + num;
ddc++;