MCPcopy Create free account
hub / github.com/apache/impala / GetSubSecond

Function GetSubSecond

be/src/util/time.cc:38–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38static inline int64_t GetSubSecond(const chrono::system_clock::time_point& t,
39 TimePrecision p) {
40 auto frac = t.time_since_epoch();
41 if (p == TimePrecision::Millisecond) {
42 auto subsec = chrono::duration_cast<chrono::milliseconds>(frac) % MILLIS_PER_SEC;
43 return subsec.count();
44 } else if (p == TimePrecision::Microsecond) {
45 auto subsec = chrono::duration_cast<chrono::microseconds>(frac) % MICROS_PER_SEC;
46 return subsec.count();
47 } else if (p == TimePrecision::Nanosecond) {
48 auto subsec = chrono::duration_cast<chrono::nanoseconds>(frac) % NANOS_PER_SEC;
49 return subsec.count();
50 } else {
51 return 0;
52 }
53}
54
55// Convert the given 'second' unix timestamp, into a date-time string in the
56// UTC time zone if 'utc' is true, or the local time zone if it is false.

Callers 1

ToStringFunction · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected