]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: object lock uses std::chrono date/year conversions 52056/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 14 Jun 2023 13:09:31 +0000 (09:09 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 14 Jun 2023 13:09:31 +0000 (09:09 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_object_lock.cc

index 17561793e3c040f8fe2f19b2ee739ffcebaeb389..1d44328fe696c812fb59bdbe0d3e84e1cf29a39b 100644 (file)
@@ -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) {