Commit f7c22f52 by Abseil Team Committed by Copybara-Service

constinit -> constexpr for DisplayUnits

PiperOrigin-RevId: 674283690
Change-Id: I5ff9fd54af1175c2eb71fb942f10834f7be6bf9f
parent f555f69b
......@@ -718,13 +718,12 @@ struct DisplayUnit {
int prec;
double pow10;
};
ABSL_CONST_INIT const DisplayUnit kDisplayNano = {"ns", 2, 1e2};
ABSL_CONST_INIT const DisplayUnit kDisplayMicro = {"us", 5, 1e5};
ABSL_CONST_INIT const DisplayUnit kDisplayMilli = {"ms", 8, 1e8};
ABSL_CONST_INIT const DisplayUnit kDisplaySec = {"s", 11, 1e11};
ABSL_CONST_INIT const DisplayUnit kDisplayMin = {"m", -1, 0.0}; // prec ignored
ABSL_CONST_INIT const DisplayUnit kDisplayHour = {"h", -1,
0.0}; // prec ignored
constexpr DisplayUnit kDisplayNano = {"ns", 2, 1e2};
constexpr DisplayUnit kDisplayMicro = {"us", 5, 1e5};
constexpr DisplayUnit kDisplayMilli = {"ms", 8, 1e8};
constexpr DisplayUnit kDisplaySec = {"s", 11, 1e11};
constexpr DisplayUnit kDisplayMin = {"m", -1, 0.0}; // prec ignored
constexpr DisplayUnit kDisplayHour = {"h", -1, 0.0}; // prec ignored
void AppendNumberUnit(std::string* out, int64_t n, DisplayUnit unit) {
char buf[sizeof("2562047788015216")]; // hours in max duration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment