diff options
-rw-r--r-- | src/rgw/rgw_common.cc | 8 | ||||
-rw-r--r-- | src/rgw/rgw_common.h | 1 | ||||
-rw-r--r-- | src/rgw/rgw_loadgen.cc | 4 | ||||
-rw-r--r-- | src/rgw/rgw_rest_client.cc | 5 |
4 files changed, 11 insertions, 7 deletions
diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index d7fb6cfdcf2..5d26d1bd67e 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -662,6 +662,14 @@ void rgw_to_iso8601(const real_time& t, string *dest) *dest = buf; } + +string rgw_to_asctime(const utime_t& t) +{ + stringstream s; + t.asctime(s); + return s.str(); +} + /* * calculate the sha1 value of a given msg and key */ diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 1ca88ebb99a..2e96758d881 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -2182,6 +2182,7 @@ extern string rgw_trim_quotes(const string& val); extern void rgw_to_iso8601(const real_time& t, char *dest, int buf_size); extern void rgw_to_iso8601(const real_time& t, string *dest); +extern std::string rgw_to_asctime(const utime_t& t); /** Check if the req_state's user has the necessary permissions * to do the requested action */ diff --git a/src/rgw/rgw_loadgen.cc b/src/rgw/rgw_loadgen.cc index edf95cc2ca9..0badc78e84b 100644 --- a/src/rgw/rgw_loadgen.cc +++ b/src/rgw/rgw_loadgen.cc @@ -13,9 +13,7 @@ void RGWLoadGenRequestEnv::set_date(utime_t& tm) { - stringstream s; - tm.asctime(s); - date_str = s.str(); + date_str = rgw_to_asctime(tm); } int RGWLoadGenRequestEnv::sign(RGWAccessKey& access_key) diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index ad9daaab6f4..fb61f326bd2 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -99,10 +99,7 @@ int RGWRESTSimpleRequest::receive_header(void *ptr, size_t len) static void get_new_date_str(string& date_str) { - utime_t tm = ceph_clock_now(); - stringstream s; - tm.asctime(s); - date_str = s.str(); + date_str = rgw_to_asctime(ceph_clock_now()); } int RGWRESTSimpleRequest::execute(RGWAccessKey& key, const char *method, const char *resource) |