Source
from_decimal(timestamp, CUID_BASE_36, ((zbx_uint64_t)current_time.tv_sec * 1000 + current_time.tv_usec / 1000));
/*
** 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/>.
**/
static char host_block[HOST_TMP_36_BASE_BUF_LEN];
/******************************************************************************
* *
* Purpose: modify string in-place to the specified length as required by *
* CUID algorithm *
* *
* Parameters: *
* input - [IN/OUT] input string and result *
* input_alloc - [IN] buffer size where the input string is stored. It *
* should be larger than 'pad_size'. *
* pad_size - [IN] target length *
* fill_char - [IN] character used to fill target string if there are *
* not enough existing characters *
* *
******************************************************************************/
static void pad(char *input, size_t input_alloc, size_t pad_size, char fill_char)
{
size_t input_len;
if (pad_size == (input_len = strlen(input)))
return;
if (pad_size > input_len) /* make string longer by prepending fill_char s */
{
if (pad_size + 1 > input_alloc || input_len + 1 > input_alloc)
{