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

Unified Diff: base/time_unittest.cc

Issue 13818027: posix: replace nonstandard futimes call with futimens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change Time::ToTimeVal to Time::ToTimeSpec Created 7 years, 8 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
« base/time.h ('K') | « base/time_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time_unittest.cc
diff --git a/base/time_unittest.cc b/base/time_unittest.cc
index dd6d26bfa537666d58ba250e6998bc5bd8ecdea9..4e79069dd34bd1e53d0660d1b540f02d00fc89b3 100644
--- a/base/time_unittest.cc
+++ b/base/time_unittest.cc
@@ -101,7 +101,11 @@ TEST_F(TimeTest, JsTime) {
#if defined(OS_POSIX)
TEST_F(TimeTest, FromTimeVal) {
Time now = Time::Now();
- Time also_now = Time::FromTimeVal(now.ToTimeVal());
+ timespec ts = now.ToTimeSpec();
+ timeval tv;
+ tv.tv_sec = ts.tv_sec;
+ tv.tv_usec = ts.tv_nsec / 1000;
+ Time also_now = Time::FromTimeVal(tv);
EXPECT_EQ(now, also_now);
}
#endif // OS_POSIX
@@ -504,15 +508,15 @@ TEST_F(TimeTest, MaxConversions) {
EXPECT_EQ(std::numeric_limits<time_t>::max(), t.ToTimeT());
#if defined(OS_POSIX)
- struct timeval tval;
+ timeval tval;
tval.tv_sec = std::numeric_limits<time_t>::max();
tval.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1;
t = Time::FromTimeVal(tval);
EXPECT_TRUE(t.is_max());
- tval = t.ToTimeVal();
- EXPECT_EQ(std::numeric_limits<time_t>::max(), tval.tv_sec);
- EXPECT_EQ(static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1,
- tval.tv_usec);
+ timespec tspec = t.ToTimeSpec();
+ EXPECT_EQ(std::numeric_limits<time_t>::max(), tspec.tv_sec);
+ EXPECT_EQ(static_cast<long>(Time::kNanosecondsPerSecond) - 1,
+ tspec.tv_nsec);
#endif
#if defined(OS_MACOSX)
« base/time.h ('K') | « base/time_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698