MCPcopy Create free account
hub / github.com/apache/brpc / ToJsTime

Method ToJsTime

src/butil/time/time.cc:168–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168double Time::ToJsTime() const {
169 if (is_null()) {
170 // Preserve 0 so the invalid result doesn't depend on the platform.
171 return 0;
172 }
173 if (is_max()) {
174 // Preserve max without offset to prevent overflow.
175 return std::numeric_limits<double>::infinity();
176 }
177 return (static_cast<double>(us_ - kTimeTToMicrosecondsOffset) /
178 kMicrosecondsPerMillisecond);
179}
180
181int64_t Time::ToJavaTime() const {
182 if (is_null()) {

Callers 1

TEST_FFunction · 0.80

Calls 2

is_nullFunction · 0.85
is_maxFunction · 0.85

Tested by 1

TEST_FFunction · 0.64