]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: list objects shows time in GMT, thread safety fix
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 17 Aug 2011 18:42:18 +0000 (11:42 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 17 Aug 2011 18:42:18 +0000 (11:42 -0700)
src/rgw/rgw_log.cc
src/rgw/rgw_rest.cc
src/rgw/rgw_rest_s3.cc

index 24b8db5bc4efa7c4d956cdfb7af20a04a6897f7a..94b703f636564155a20203f128d361aacf3b5afe 100644 (file)
@@ -73,7 +73,7 @@ int rgw_log_op(struct req_state *s)
 
   struct tm bdt;
   time_t t = entry.time.sec();
-  localtime_r(&t, &bdt);
+  gmtime_r(&t, &bdt);
   
   char buf[entry.bucket.size() + 16];
   sprintf(buf, "%.4d-%.2d-%.2d-%d-%s", (bdt.tm_year+1900), (bdt.tm_mon+1), bdt.tm_mday, s->pool_id, entry.bucket.c_str());
@@ -109,7 +109,7 @@ int rgw_log_intent(struct req_state *s, rgw_obj& obj, RGWIntentEvent intent)
 
   struct tm bdt;
   time_t t = entry.op_time.sec();
-  localtime_r(&t, &bdt);
+  gmtime_r(&t, &bdt);
 
   char buf[obj.bucket.size() + 16];
   sprintf(buf, "%.4d-%.2d-%.2d-%d-%s", (bdt.tm_year+1900), (bdt.tm_mon+1), bdt.tm_mday, s->pool_id, obj.bucket.c_str());
index 62f332d9986dc28311611a9901a6b691b3254d1c..abd18337dbf4c0c55b48ae59db4ea62f226f853c 100644 (file)
@@ -118,7 +118,8 @@ void dump_last_modified(struct req_state *s, time_t t)
 void dump_time(struct req_state *s, const char *name, time_t *t)
 {
   char buf[TIME_BUF_SIZE];
-  struct tm *tmp = localtime(t);
+  struct tm result;
+  struct tm *tmp = gmtime_r(t, &result);
   if (tmp == NULL)
     return;
 
index 0e73b132bc73799bf3ad93a335a95e189d448f93..9088d57ab4e18a3f94a6877e9da6c553bf412e0b 100644 (file)
@@ -330,7 +330,7 @@ void RGWListMultipart_REST_S3::send_response()
 
       time_t sec = info.modified.sec();
       struct tm tmp;
-      localtime_r(&sec, &tmp);
+      gmtime_r(&sec, &tmp);
       char buf[TIME_BUF_SIZE];
       if (strftime(buf, sizeof(buf), "%Y-%m-%dT%T.000Z", &tmp) > 0) {
         s->formatter->dump_format("LastModified", buf);