Lines Matching full:time
5 #include "base/time.h"
7 #include <sys/time.h>
8 #include <time.h>
20 if (microseconds >= Time::kMicrosecondsPerSecond) {
22 microseconds -= seconds * Time::kMicrosecondsPerSecond;
26 microseconds * Time::kNanosecondsPerMicrosecond};
31 // The Time routines in this file use standard POSIX routines, or almost-
35 // Time -----------------------------------------------------------------------
38 // so that our time representations match across all platforms. See bug 14734.
39 // irb(main):010:0> Time.at(0).getutc()
41 // irb(main):011:0> Time.at(-11644473600).getutc()
45 kWindowsEpochDeltaSeconds * Time::kMillisecondsPerSecond;
48 const int64 Time::kWindowsEpochDeltaMicroseconds =
49 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond;
51 // Some functions in time.cc use time_t directly, so we provide an offset
54 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds;
57 Time Time::Now() {
61 DCHECK(0) << "Could not determine time of day";
66 return Time((tv.tv_sec * kMicrosecondsPerSecond + tv.tv_usec) +
71 Time Time::NowFromSystemTime() {
72 // Just use Now() because Now() returns the system time.
76 void Time::Explode(bool is_local, Exploded* exploded) const {
77 // Time stores times with microsecond resolution, but Exploded only carries
101 Time Time::FromExploded(bool is_local, const Exploded& exploded) {
126 // than failing here or ignoring the overflow case and treating each time
131 // time indicating 1 second prior to the epoch. (1970 is allowed to handle
132 // time zone and DST offsets.) Otherwise, return the most future or past
133 // time representable. Assumes the time_t epoch is 1970-01-01 00:00:00 UTC.
137 // proper round-tripping between exploded and counter-type time
141 // When representing the most distant time in the future, add in an extra
142 // 999ms to avoid the time being less than any other possible value that
157 return Time((milliseconds * kMicrosecondsPerMillisecond) +
178 (static_cast<int64>(ts.tv_sec) * Time::kMicrosecondsPerSecond) +
179 (static_cast<int64>(ts.tv_nsec) / Time::kNanosecondsPerMicrosecond);
204 struct timeval Time::ToTimeVal() const {
207 result.tv_sec = us / Time::kMicrosecondsPerSecond;
208 result.tv_usec = us % Time::kMicrosecondsPerSecond;