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

Side by Side Diff: base/time.h

Issue 16093026: Provide nanoseconds precision for base::PlatformFileInfo on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: st_?time_nsec doe not exist in the bots' NDK, use FromTimeT for Android Created 7 years, 6 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/file_util_posix.cc ('k') | base/time.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Time represents an absolute point in time, internally represented as 5 // Time represents an absolute point in time, internally represented as
6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC)
7 // (See http://crbug.com/14734). System-dependent clock interface routines are 7 // (See http://crbug.com/14734). System-dependent clock interface routines are
8 // defined in time_PLATFORM.cc. 8 // defined in time_PLATFORM.cc.
9 // 9 //
10 // TimeDelta represents a duration of time, internally represented in 10 // TimeDelta represents a duration of time, internally represented in
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 time_t ToTimeT() const; 279 time_t ToTimeT() const;
280 280
281 // Converts time to/from a double which is the number of seconds since epoch 281 // Converts time to/from a double which is the number of seconds since epoch
282 // (Jan 1, 1970). Webkit uses this format to represent time. 282 // (Jan 1, 1970). Webkit uses this format to represent time.
283 // Because WebKit initializes double time value to 0 to indicate "not 283 // Because WebKit initializes double time value to 0 to indicate "not
284 // initialized", we map it to empty Time object that also means "not 284 // initialized", we map it to empty Time object that also means "not
285 // initialized". 285 // initialized".
286 static Time FromDoubleT(double dt); 286 static Time FromDoubleT(double dt);
287 double ToDoubleT() const; 287 double ToDoubleT() const;
288 288
289 #if defined(OS_POSIX)
290 // Converts the timespec structure to time. MacOS X 10.8.3 (and tentatively,
291 // earlier versions) will have the |ts|'s tv_nsec component zeroed out,
292 // having a 1 second resolution, which agrees with
293 // https://developer.apple.com/legacy/library/#technotes/tn/tn1150.html#HFSPlu sDates.
294 static Time FromTimeSpec(const timespec& ts);
295 #endif
296
289 // Converts to/from the Javascript convention for times, a number of 297 // Converts to/from the Javascript convention for times, a number of
290 // milliseconds since the epoch: 298 // milliseconds since the epoch:
291 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/g etTime. 299 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/g etTime.
292 static Time FromJsTime(double ms_since_epoch); 300 static Time FromJsTime(double ms_since_epoch);
293 double ToJsTime() const; 301 double ToJsTime() const;
294 302
295 #if defined(OS_POSIX) 303 #if defined(OS_POSIX)
296 static Time FromTimeVal(struct timeval t); 304 static Time FromTimeVal(struct timeval t);
297 struct timeval ToTimeVal() const; 305 struct timeval ToTimeVal() const;
298 #endif 306 #endif
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 #endif 642 #endif
635 }; 643 };
636 644
637 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 645 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
638 return TimeTicks(t.ticks_ + delta_); 646 return TimeTicks(t.ticks_ + delta_);
639 } 647 }
640 648
641 } // namespace base 649 } // namespace base
642 650
643 #endif // BASE_TIME_H_ 651 #endif // BASE_TIME_H_
OLDNEW
« no previous file with comments | « base/file_util_posix.cc ('k') | base/time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698