Deprecate crm_time_free() through crm_time_add_years()#4153
Open
nrwahl2 wants to merge 26 commits into
Open
Conversation
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_time_get_seconds_since_epoch(). The name "pcmk__time_to_unix()" is chosen in order to align with g_date_time_to_unix(), which we plan to adopt eventually. During development, I used an assertion to validate that the new epoch_seconds calculation matches the old EPOCH_SECONDS constant. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to inspect a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It's equivalent to free(). There are no dynamically allocated fields within crm_time_t. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Use free() instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Previously it would dereference a NULL argument. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace pcmk_copy_time(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to copy a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_time_add(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_time_subtract(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to subtract from a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_time_add_seconds(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add seconds to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Previously, the (value * SECONDS_IN_MINUTE) computation could overflow. This is not the most efficient implementation; we could avoid the for loops in the common case where the multiplication does not overflow. However, that seems to me like premature optimization. Simplicity and readability seem more important than here. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add minutes to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Previously, the (value * SECONDS_IN_HOUR) computation could overflow. This is not the most efficient implementation; we could avoid the for loops in the common case where the multiplication does not overflow. However, that seems to me like premature optimization. Simplicity and readability seem more important than here. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add hours to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_time_add_days(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add days to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Previously, the (value * 7) computation could overflow. This is not the most efficient implementation; we could avoid the for loops in the common case where the multiplication does not overflow. However, that seems to me like premature optimization. Simplicity and readability seem more important than here. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add weeks to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add months to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_time_add_years(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
External callers have no need to add years to a crm_time_t object. Pacemaker should not be used for general-purpose date/time manipulation. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the next batch from #4097.