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

Side by Side Diff: base/time_posix.cc

Issue 67276: Retrial of the first step to port file_util::CountFilesCreatedAfter()... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/time_mac.cc ('k') | base/time_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/time.h" 5 #include "base/time.h"
6 6
7 #ifdef OS_MACOSX 7 #ifdef OS_MACOSX
8 #include <mach/mach_time.h> 8 #include <mach/mach_time.h>
9 #endif 9 #endif
10 #include <sys/time.h> 10 #include <sys/time.h>
(...skipping 23 matching lines...) Expand all
34 struct timezone tz = { 0, 0 }; // UTC 34 struct timezone tz = { 0, 0 }; // UTC
35 if (gettimeofday(&tv, &tz) != 0) { 35 if (gettimeofday(&tv, &tz) != 0) {
36 DCHECK(0) << "Could not determine time of day"; 36 DCHECK(0) << "Could not determine time of day";
37 } 37 }
38 // Combine seconds and microseconds in a 64-bit field containing microseconds 38 // Combine seconds and microseconds in a 64-bit field containing microseconds
39 // since the epoch. That's enough for nearly 600 centuries. 39 // since the epoch. That's enough for nearly 600 centuries.
40 return tv.tv_sec * kMicrosecondsPerSecond + tv.tv_usec; 40 return tv.tv_sec * kMicrosecondsPerSecond + tv.tv_usec;
41 } 41 }
42 42
43 // static 43 // static
44 Time Time::NowFromSystemTime() {
45 // Just use Now() because Now() returns the system time.
46 return Now();
47 }
48
49 // static
44 Time Time::FromExploded(bool is_local, const Exploded& exploded) { 50 Time Time::FromExploded(bool is_local, const Exploded& exploded) {
45 struct tm timestruct; 51 struct tm timestruct;
46 timestruct.tm_sec = exploded.second; 52 timestruct.tm_sec = exploded.second;
47 timestruct.tm_min = exploded.minute; 53 timestruct.tm_min = exploded.minute;
48 timestruct.tm_hour = exploded.hour; 54 timestruct.tm_hour = exploded.hour;
49 timestruct.tm_mday = exploded.day_of_month; 55 timestruct.tm_mday = exploded.day_of_month;
50 timestruct.tm_mon = exploded.month - 1; 56 timestruct.tm_mon = exploded.month - 1;
51 timestruct.tm_year = exploded.year - 1900; 57 timestruct.tm_year = exploded.year - 1900;
52 timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this 58 timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this
53 timestruct.tm_yday = 0; // mktime/timegm ignore this 59 timestruct.tm_yday = 0; // mktime/timegm ignore this
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 175
170 return TimeTicks(absolute_micro); 176 return TimeTicks(absolute_micro);
171 } 177 }
172 178
173 // static 179 // static
174 TimeTicks TimeTicks::HighResNow() { 180 TimeTicks TimeTicks::HighResNow() {
175 return Now(); 181 return Now();
176 } 182 }
177 183
178 } // namespace base 184 } // namespace base
OLDNEW
« no previous file with comments | « base/time_mac.cc ('k') | base/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698