Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Issue 8771: time overflow (Closed)

Created:
12 years, 1 month ago by Mark Mentovai
Modified:
9 years, 7 months ago
Reviewers:
Dean McNamee, wtc
CC:
chromium-reviews_googlegroups.com
Base URL:
svn://chrome-svn.corp.google.com/chrome/trunk/src/
Visibility:
Public.

Description

Handle time overflow more gracefully in base/time_posix.cc. Instead of asserting when encountering time overflow, use the most distant future or past time representation possible. This fixes assertions that occur when handling cookies that expire well in the future. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=4631

Patch Set 1 #

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -3 lines) Patch
M base/time_posix.cc View 1 2 chunks +23 lines, -3 lines 4 comments Download

Messages

Total messages: 5 (0 generated)
Mark Mentovai
This is similar, but slightly different, from PR_ImplodeTime in base/third_party/nspr/prtime.cc. PR_ImplodeTime seems to be present ...
12 years, 1 month ago (2008-10-31 17:06:25 UTC) #1
wtc
http://codereview.chromium.org/8771/diff/1/2 File base/time_posix.cc (right): http://codereview.chromium.org/8771/diff/1/2#newcode56 Line 56: timestruct.tm_zone = NULL; // not a POSIX field, ...
12 years, 1 month ago (2008-10-31 17:39:25 UTC) #2
wtc
http://codereview.chromium.org/8771/diff/5/6 File base/time_posix.cc (right): http://codereview.chromium.org/8771/diff/5/6#newcode73 Line 73: milliseconds = std::numeric_limits<time_t>::min() * Some points to ponder: ...
12 years, 1 month ago (2008-10-31 20:52:01 UTC) #3
Mark Mentovai
http://codereview.chromium.org/8771/diff/5/6 File base/time_posix.cc (right): http://codereview.chromium.org/8771/diff/5/6#newcode73 Line 73: milliseconds = std::numeric_limits<time_t>::min() * wtc wrote: > - ...
12 years, 1 month ago (2008-10-31 21:21:01 UTC) #4
wtc
12 years, 1 month ago (2008-11-03 19:40:27 UTC) #5
LGTM.

It would be nice to add a short comment to explain that
you clamp at the minimally and maximally representable
times for the time_t type and you want to make roundtripping
work.

I didn't realize Standard C doesn't specify the epoch for
time_t.  If some existing unit tests validate our assumption
of the epoch being 1970 and that time_t is an integral type,
we don't need to add static assertions here.

Powered by Google App Engine
This is Rietveld 408576698