Skip to content

Commit f6540ec

Browse files
committed
API: libcrmcommon: Deprecate crm_time_parse_duration()
Pacemaker parses durations from strings in a few places. However, there is no need for external code to do this for the purpose of administering Pacemaker. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent c4e8f14 commit f6540ec

3 files changed

Lines changed: 10 additions & 19 deletions

File tree

include/crm/common/iso8601.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ char *crm_time_as_string(const crm_time_t *dt, int flags);
6969
#define crm_time_epoch 0x200
7070
#define crm_time_usecs 0x400
7171

72-
crm_time_t *crm_time_parse_duration(const char *duration_str);
73-
7472
int crm_time_compare(const crm_time_t *a, const crm_time_t *b);
7573

7674
int crm_time_get_timeofday(const crm_time_t *dt, uint32_t *h, uint32_t *m,

include/crm/common/iso8601_compat.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ crm_time_period_t *crm_time_parse_period(const char *period_str);
8282
//! \deprecated Do not use
8383
crm_time_t *crm_time_calculate_duration(const crm_time_t *dt,
8484
const crm_time_t *value);
85+
86+
//! \deprecated Do not use
87+
crm_time_t *crm_time_parse_duration(const char *duration_str);
88+
8589
#ifdef __cplusplus
8690
}
8791
#endif

lib/common/iso8601.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,23 +1357,6 @@ pcmk__time_parse_duration(const char *period_s)
13571357
return NULL;
13581358
}
13591359

1360-
/*!
1361-
* \brief Parse a time duration from an ISO 8601 duration specification
1362-
*
1363-
* \param[in] period_s ISO 8601 duration specification (optionally followed by
1364-
* whitespace, after which the rest of the string will be
1365-
* ignored)
1366-
*
1367-
* \return New time object on success, NULL (and set errno) otherwise
1368-
* \note It is the caller's responsibility to return the result using
1369-
* crm_time_free().
1370-
*/
1371-
crm_time_t *
1372-
crm_time_parse_duration(const char *period_s)
1373-
{
1374-
return pcmk__time_parse_duration(period_s);
1375-
}
1376-
13771360
/*!
13781361
* \internal
13791362
* \brief Set one time object to another if the other is earlier
@@ -2433,5 +2416,11 @@ crm_time_calculate_duration(const crm_time_t *dt, const crm_time_t *value)
24332416
return subtract_time(dt, value, true);
24342417
}
24352418

2419+
crm_time_t *
2420+
crm_time_parse_duration(const char *period_s)
2421+
{
2422+
return pcmk__time_parse_duration(period_s);
2423+
}
2424+
24362425
// LCOV_EXCL_STOP
24372426
// End deprecated API

0 commit comments

Comments
 (0)