summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-19 22:35:29 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-19 22:35:29 +0000
commit5cca3a55b3f1c25c5b3a19c3b42227aae34e4abf (patch)
tree01cd3db90399f7c24d3aea3593fd2d5feb35f106 /net
parentaac13f594195df51eb1e4e35ea2863659cb4de54 (diff)
downloadchromium_src-5cca3a55b3f1c25c5b3a19c3b42227aae34e4abf.zip
chromium_src-5cca3a55b3f1c25c5b3a19c3b42227aae34e4abf.tar.gz
chromium_src-5cca3a55b3f1c25c5b3a19c3b42227aae34e4abf.tar.bz2
Move time formatters that only use ICU into base/time.*
This allows us to use the time formatters in, e.g., net or webkit. Remove CookieExpires since it's not used. BUG=1164516 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1063 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_util.cc26
1 files changed, 4 insertions, 22 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index efcdc66..fe26d14 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -50,6 +50,7 @@
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/time.h"
+#include "base/time_format.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon.h"
#include "googleurl/src/url_parse.h"
@@ -640,26 +641,6 @@ void IDNToUnicodeOneComponent(const wchar_t* comp,
(*out)[host_begin_in_output + i] = comp[i];
}
-// Convert a FILETIME to a localized string. |filetime| may be NULL.
-// TODO(tc): Remove this once bug 1164516 is fixed.
-std::wstring LocalizedDateTime(const FILETIME* filetime) {
- if (!filetime)
- return std::wstring();
-
- Time time = Time::FromFileTime(*filetime);
- scoped_ptr<DateFormat> formatter(DateFormat::createDateTimeInstance(
- DateFormat::kShort));
- UnicodeString date_string;
- formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
-
- std::wstring formatted;
- int capacity = date_string.length() + 1;
- UErrorCode error = U_ZERO_ERROR;
- date_string.extract(static_cast<UChar*>(WriteInto(&formatted, capacity)),
- capacity, error);
- return formatted;
-}
-
} // namespace
namespace net {
@@ -912,8 +893,9 @@ std::string GetDirectoryListingEntry(const std::string& name,
result.append(",");
- string_escape::JavascriptDoubleQuote(
- LocalizedDateTime(modified), true, &result);
+ Time time(Time::FromFileTime(*modified));
+ string_escape::JavascriptDoubleQuote(base::TimeFormatShortDateAndTime(time),
+ true, &result);
result.append(");</script>\n");