Lines Matching refs:ts
103 TimeDelta TimeDelta::FromMachTimespec(struct mach_timespec ts) { in FromMachTimespec() argument
104 DCHECK_GE(ts.tv_nsec, 0); in FromMachTimespec()
105 DCHECK_LT(ts.tv_nsec, in FromMachTimespec()
107 return TimeDelta(ts.tv_sec * Time::kMicrosecondsPerSecond + in FromMachTimespec()
108 ts.tv_nsec / Time::kNanosecondsPerMicrosecond); in FromMachTimespec()
113 struct mach_timespec ts; in ToMachTimespec() local
115 ts.tv_sec = static_cast<unsigned>(delta_ / Time::kMicrosecondsPerSecond); in ToMachTimespec()
116 ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) * in ToMachTimespec()
118 return ts; in ToMachTimespec()
126 TimeDelta TimeDelta::FromTimespec(struct timespec ts) { in FromTimespec() argument
127 DCHECK_GE(ts.tv_nsec, 0); in FromTimespec()
128 DCHECK_LT(ts.tv_nsec, in FromTimespec()
130 return TimeDelta(ts.tv_sec * Time::kMicrosecondsPerSecond + in FromTimespec()
131 ts.tv_nsec / Time::kNanosecondsPerMicrosecond); in FromTimespec()
136 struct timespec ts; in ToTimespec() local
137 ts.tv_sec = static_cast<time_t>(delta_ / Time::kMicrosecondsPerSecond); in ToTimespec()
138 ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) * in ToTimespec()
140 return ts; in ToTimespec()
269 Time Time::FromTimespec(struct timespec ts) { in FromTimespec() argument
270 DCHECK(ts.tv_nsec >= 0); in FromTimespec()
271 DCHECK(ts.tv_nsec < static_cast<long>(kNanosecondsPerSecond)); // NOLINT in FromTimespec()
272 if (ts.tv_nsec == 0 && ts.tv_sec == 0) { in FromTimespec()
275 if (ts.tv_nsec == static_cast<long>(kNanosecondsPerSecond - 1) && // NOLINT in FromTimespec()
276 ts.tv_sec == std::numeric_limits<time_t>::max()) { in FromTimespec()
279 return Time(ts.tv_sec * kMicrosecondsPerSecond + in FromTimespec()
280 ts.tv_nsec / kNanosecondsPerMicrosecond); in FromTimespec()
285 struct timespec ts; in ToTimespec() local
287 ts.tv_sec = 0; in ToTimespec()
288 ts.tv_nsec = 0; in ToTimespec()
289 return ts; in ToTimespec()
292 ts.tv_sec = std::numeric_limits<time_t>::max(); in ToTimespec()
293 ts.tv_nsec = static_cast<long>(kNanosecondsPerSecond - 1); // NOLINT in ToTimespec()
294 return ts; in ToTimespec()
296 ts.tv_sec = static_cast<time_t>(us_ / kMicrosecondsPerSecond); in ToTimespec()
297 ts.tv_nsec = (us_ % kMicrosecondsPerSecond) * kNanosecondsPerMicrosecond; in ToTimespec()
298 return ts; in ToTimespec()
552 struct timespec ts; in HighResolutionNow() local
553 int result = clock_gettime(CLOCK_MONOTONIC, &ts); in HighResolutionNow()
556 ticks = (ts.tv_sec * Time::kMicrosecondsPerSecond + in HighResolutionNow()
557 ts.tv_nsec / Time::kNanosecondsPerMicrosecond); in HighResolutionNow()
593 struct timespec ts; in Now() local
595 clock_gettime(clock_id_, &ts); in Now()
596 return ((int64_t)ts.tv_sec * kNsecPerSec) + ts.tv_nsec; in Now()