Source
static void zbx_vector_history_record_str_uniq(zbx_vector_history_record_t *vector, zbx_compare_func_t compare_func)
/*
** 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/>.
**/
ZBX_PTR_VECTOR_IMPL(valuemaps_ptr, zbx_valuemaps_t *)
/******************************************************************************
* *
* Purpose: process suffix 'uptime'. *
* *
* Parameters: value - [IN/OUT] value for adjusting *
* max_len - [IN] max len of value *
* *
******************************************************************************/
static void add_value_suffix_uptime(char *value, size_t max_len)
{
double secs, days;
size_t offset = 0;
int hours, mins;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
if (0 > (secs = round(atof(value))))
{
offset += zbx_snprintf(value, max_len, "-");
secs = -secs;
}
days = floor(secs / SEC_PER_DAY);
secs -= days * SEC_PER_DAY;
hours = (int)(secs / SEC_PER_HOUR);
secs -= (double)hours * SEC_PER_HOUR;
mins = (int)(secs / SEC_PER_MIN);
secs -= (double)mins * SEC_PER_MIN;
if (0 != days)
{
if (1 == days)
offset += zbx_snprintf(value + offset, max_len - offset, ZBX_FS_DBL_EXT(0) " day, ", days);
else
offset += zbx_snprintf(value + offset, max_len - offset, ZBX_FS_DBL_EXT(0) " days, ", days);
}
zbx_snprintf(value + offset, max_len - offset, "%02d:%02d:%02d", hours, mins, (int)secs);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __func__);
}
/******************************************************************************
* *
* Purpose: process suffix 's'. *
* *
* Parameters: value - [IN/OUT] value for adjusting *
* max_len - [IN] max len of value *
* *
******************************************************************************/