Project

General

Profile

Feature #302 » gmt_times.patch

Convert all times to GMT - Wido den Hollander, 07/26/2010 02:01 PM

View differences:

src/rgw/rgw_common.cc
{
struct tm tm;
memset(&tm, 0, sizeof(struct tm));
if (!strptime(time_str, "%a, %d %b %Y %H:%M:%S GMT", &tm))
if (!strptime(time_str, "%a, %d %b %Y %H:%M:%S %Z", &tm))
return -EINVAL;
*time = mktime(&tm);
src/rgw/rgw_rados.cc
uint64_t size;
bufferlist etag;
time_t mtime;
time_t ctime;
map<string, bufferlist>::iterator iter;
......
goto done_err;
}
/* Convert all times go GMT to make them compatible */
ctime = mktime(gmtime(&mtime));
r = -ECANCELED;
if (mod_ptr) {
if (mtime < *mod_ptr) {
cout << "mod_ptr: " << *mod_ptr << " ctime: " << ctime << endl;
if (ctime < *mod_ptr) {
err->num = "304";
err->code = "NotModified";
goto done_err;
......
}
if (unmod_ptr) {
if (mtime >= *mod_ptr) {
err->num = "412";
err->code = "PreconditionFailed";
if (ctime > *mod_ptr) {
err->num = "304";
err->code = "NotModified";
goto done_err;
}
}
(2-2/2)