]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: extend date/time parsing
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 15 Mar 2016 20:29:48 +0000 (13:29 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 15 Mar 2016 20:29:48 +0000 (13:29 -0700)
So that we can parse correctly time encoded using utime_t::gmtime()

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_common.cc

index 62f02ed309afb71910c5d77e9119acdda9f3755a..d597339a7e70f702720241354889b072551b59ca 100644 (file)
@@ -396,10 +396,14 @@ bool parse_iso8601(const char *s, struct tm *t, uint32_t *pns, bool extended_for
   if (!s)
     s = "";
 
-  if (extended_format)
+  if (extended_format) {
     p = strptime(s, "%Y-%m-%dT%T", t);
-  else
+    if (!p) {
+      p = strptime(s, "%Y-%m-%d %T", t);
+    }
+  } else {
     p = strptime(s, "%Y%m%dT%H%M%S", t);
+  }
   if (!p) {
     dout(0) << "parse_iso8601 failed" << dendl;
     return false;