diff options
author | Viktors Tjarve <viktors.tjarve@zabbix.com> | 2020-09-24 15:31:54 +0300 |
---|---|---|
committer | Viktors Tjarve <viktors.tjarve@zabbix.com> | 2020-09-24 15:31:54 +0300 |
commit | 158b70b2aac3012901942fa9988b2178564db6ec (patch) | |
tree | d498490272c1376cb2562754c2a8fadd0015eebd /include | |
parent | 345811bb797ef9f1b8008b570bb9fa0316041395 (diff) |
........S. [ZBXNEXT-6184] added formatting macro functions fmttime and fmtnum
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 18 | ||||
-rw-r--r-- | include/zbxtypes.h | 4 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index ae29dfec97b..ae6a82f7db5 100644 --- a/include/common.h +++ b/include/common.h @@ -1093,6 +1093,7 @@ time_t calculate_proxy_nextcheck(zbx_uint64_t hostid, unsigned int delay, time_t int zbx_check_time_period(const char *period, time_t time, const char *tz, int *res); void zbx_hex2octal(const char *input, char **output, int *olen); int str_in_list(const char *list, const char *value, char delimiter); +int str_n_in_list(const char *list, const char *value, size_t len, char delimiter); char *str_linefeed(const char *src, size_t maxline, const char *delim); void zbx_strarr_init(char ***arr); void zbx_strarr_add(char ***arr, const char *entry); @@ -1652,4 +1653,21 @@ int zbx_str_extract(const char *text, size_t len, char **value); #define AUDIT_ACTION_EXECUTE 7 #define AUDIT_RESOURCE_SCRIPT 25 +typedef enum +{ + ZBX_TIME_UNIT_UNKNOWN, + ZBX_TIME_UNIT_HOUR, + ZBX_TIME_UNIT_DAY, + ZBX_TIME_UNIT_WEEK, + ZBX_TIME_UNIT_MONTH, + ZBX_TIME_UNIT_YEAR +} +zbx_time_unit_t; + +void zbx_tm_add(struct tm *tm, int multiplier, zbx_time_unit_t base); +void zbx_tm_sub(struct tm *tm, int multiplier, zbx_time_unit_t base); + +zbx_time_unit_t zbx_tm_str_to_unit(const char *text); +int zbx_tm_parse_period(const char *period, size_t *len, int *multiplier, zbx_time_unit_t *base, char **error); + #endif diff --git a/include/zbxtypes.h b/include/zbxtypes.h index 0d3a5b421ed..9495e412e7e 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -214,4 +214,8 @@ zbx_uint128_t; /* macro to test if a signed value has been assigned to unsigned type (char, short, int, long long) */ #define ZBX_IS_TOP_BIT_SET(x) (0 != ((__UINT64_C(1) << ((sizeof(x) << 3) - 1)) & (x))) +#if defined(_WINDOWS) + #define localtime_r(x, y) localtime_s(y, x) +#endif + #endif |