From 0c9b5cc06b91fadbac5709d45fb5bae487c0a39e Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 14 Jun 2023 09:09:31 -0400 Subject: [PATCH] rgw: object lock uses std::chrono date/year conversions Signed-off-by: Casey Bodley (cherry picked from commit 1396796ca9e142202c202406792e31cacfd65aec) --- src/rgw/rgw_object_lock.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_object_lock.cc b/src/rgw/rgw_object_lock.cc index 17561793e3c..1d44328fe69 100644 --- a/src/rgw/rgw_object_lock.cc +++ b/src/rgw/rgw_object_lock.cc @@ -58,11 +58,10 @@ ceph::real_time RGWObjectLock::get_lock_until_date(const ceph::real_time& mtime) if (!rule_exist) { return ceph::real_time(); } - int64_t days = get_days(); - if (days <= 0) { - days = get_years()*365; + if (int days = get_days(); days > 0) { + return mtime + std::chrono::days(days); } - return mtime + make_timespan(days*24*60*60); + return mtime + std::chrono::years(get_years()); } void RGWObjectRetention::decode_xml(XMLObj *obj) { -- 2.39.5