Source
if (NULL != jp && SUCCEED == zbx_json_value_by_name(jp, ZBX_PROTO_TAG_VERSION, value, sizeof(value), NULL))
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
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++;
break;
case 'M':
MM = 10 * MM + num;
MMc++;
break;