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

Issue 10916089: Fixing Time::Max()'s behavior with Time::ToTimeT() and friends. (Closed)

Created:
8 years, 3 months ago by Mike West
Modified:
8 years, 3 months ago
Reviewers:
Mark Mentovai, msarda
CC:
chromium-reviews, erikwright+watch_chromium.org
Visibility:
Public.

Description

Fixing Time::Max()'s behavior with Time::ToTimeT() and friends. It looks like the math that's done to convert epoch times between platforms is giving incorrect results when confronted with a "max" time. This CL adjusts the various conversion methods to persist maxness in the same way they currently persist zeroness. BUG=146328 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155591

Patch Set 1 #

Total comments: 2

Patch Set 2 : Scary casting. #

Total comments: 9

Patch Set 3 : Less poor. #

Patch Set 4 : Windows. :( #

Total comments: 6

Patch Set 5 : Feedback. #

Patch Set 6 : DWORD. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+124 lines, -6 lines) Patch
M base/time.h View 2 chunks +7 lines, -0 lines 0 comments Download
M base/time.cc View 1 2 3 4 3 chunks +26 lines, -3 lines 0 comments Download
M base/time_mac.cc View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M base/time_posix.cc View 1 2 2 chunks +15 lines, -0 lines 0 comments Download
M base/time_unittest.cc View 1 2 3 4 5 1 chunk +59 lines, -3 lines 0 comments Download
M base/time_win.cc View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Mike West
Hi Mark! As followup to the earlier addition of base::Time::Max(), would you mind taking a ...
8 years, 3 months ago (2012-09-04 11:36:10 UTC) #1
Mark Mentovai
https://chromiumcodereview.appspot.com/10916089/diff/1/base/time.h File base/time.h (right): https://chromiumcodereview.appspot.com/10916089/diff/1/base/time.h#newcode277 base/time.h:277: static Time FromTimeT(time_t tt); Max preservation for time_t, WebKit ...
8 years, 3 months ago (2012-09-04 13:23:14 UTC) #2
Mike West
Ack. I completely missed the platform-specific bits. It doesn't look like ToTimeVal or FILETIME actually ...
8 years, 3 months ago (2012-09-04 13:46:21 UTC) #3
Mark Mentovai
I’m not sure. I think it’s just a matter of some platform-specific conversions following the ...
8 years, 3 months ago (2012-09-04 13:49:42 UTC) #4
Mike West
On 2012/09/04 13:49:42, Mark Mentovai wrote: > I’m not sure. I think it’s just a ...
8 years, 3 months ago (2012-09-04 13:54:15 UTC) #5
Mike West
On 2012/09/04 13:54:15, Mike West (chromium) wrote: > On 2012/09/04 13:49:42, Mark Mentovai wrote: > ...
8 years, 3 months ago (2012-09-05 05:51:00 UTC) #6
Mark Mentovai
It’d be best if the platform-specific parts were tested too. http://codereview.chromium.org/10916089/diff/12001/base/time.cc File base/time.cc (right): http://codereview.chromium.org/10916089/diff/12001/base/time.cc#newcode78 ...
8 years, 3 months ago (2012-09-05 15:27:53 UTC) #7
Mike West
As is likely obvious, I don't do much platform-specific work. Thanks for working through the ...
8 years, 3 months ago (2012-09-05 20:25:14 UTC) #8
msarda
https://chromiumcodereview.appspot.com/10916089/diff/4007/base/time.cc File base/time.cc (right): https://chromiumcodereview.appspot.com/10916089/diff/4007/base/time.cc#newcode89 base/time.cc:89: return (us_ - kTimeTToMicrosecondsOffset) / kMicrosecondsPerSecond; There is still ...
8 years, 3 months ago (2012-09-06 15:04:34 UTC) #9
Mark Mentovai
msarda also raises an interesting point. https://chromiumcodereview.appspot.com/10916089/diff/4007/base/time_unittest.cc File base/time_unittest.cc (right): https://chromiumcodereview.appspot.com/10916089/diff/4007/base/time_unittest.cc#newcode512 base/time_unittest.cc:512: EXPECT_EQ(std::numeric_limits<time_t>::max(), t.ToTimeVal().tv_sec); Don’t ...
8 years, 3 months ago (2012-09-06 16:10:49 UTC) #10
Mike West
Thanks to you both. https://chromiumcodereview.appspot.com/10916089/diff/4007/base/time.cc File base/time.cc (right): https://chromiumcodereview.appspot.com/10916089/diff/4007/base/time.cc#newcode89 base/time.cc:89: return (us_ - kTimeTToMicrosecondsOffset) / ...
8 years, 3 months ago (2012-09-06 19:51:16 UTC) #11
msarda
LGTM.
8 years, 3 months ago (2012-09-07 07:58:20 UTC) #12
Mark Mentovai
LGTM
8 years, 3 months ago (2012-09-07 12:23:39 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mkwst@chromium.org/10916089/14010
8 years, 3 months ago (2012-09-08 07:49:47 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mkwst@chromium.org/10916089/14010
8 years, 3 months ago (2012-09-08 12:49:27 UTC) #15
commit-bot: I haz the power
8 years, 3 months ago (2012-09-08 17:50:09 UTC) #16
Change committed as 155591

Powered by Google App Engine
This is Rietveld 408576698