From: Casey Bodley Date: Wed, 14 Jun 2023 13:09:31 +0000 (-0400) Subject: rgw: object lock uses std::chrono date/year conversions X-Git-Tag: v18.2.1~388^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0c9b5cc06b91fadbac5709d45fb5bae487c0a39e;p=ceph-ci.git rgw: object lock uses std::chrono date/year conversions Signed-off-by: Casey Bodley (cherry picked from commit 1396796ca9e142202c202406792e31cacfd65aec) --- 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) {