Basically a function that accepts a `utime_t` and spits out a asctime
string representation (without newline)
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
*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
*/
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 */
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)
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)