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

Unified Diff: chrome/common/time_format.cc

Issue 10918274: chrome://downloads updateDateDisplay more often (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/time_format.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/time_format.cc
diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc
index c4cf9ca386ecb2e807813a15abf53706bf9d6d69..233090417abb340fd67b262582037d4334a0c6a2 100644
--- a/chrome/common/time_format.cc
+++ b/chrome/common/time_format.cc
@@ -325,13 +325,14 @@ string16 TimeFormat::RelativeDate(
const Time* optional_midnight_today) {
Time midnight_today = optional_midnight_today ? *optional_midnight_today :
Time::Now().LocalMidnight();
-
- // Filter out "today" and "yesterday"
- if (time >= midnight_today)
+ TimeDelta day = TimeDelta::FromMicroseconds(Time::kMicrosecondsPerDay);
+ Time tomorrow = midnight_today + day;
+ Time yesterday = midnight_today - day;
+ if (time >= tomorrow)
+ return string16();
+ else if (time >= midnight_today)
return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY);
- else if (time >= midnight_today -
- TimeDelta::FromMicroseconds(Time::kMicrosecondsPerDay))
+ else if (time >= yesterday)
return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY);
-
return string16();
}
« no previous file with comments | « chrome/common/time_format.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698