Commit 2f9563e4 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Base: Mark time constants as constexpr.

This will allow use of these constants in constexpr expressions.

Change-Id: Ia2d6f8ab6969eedbc9b9b763f7f700ffaaaee14b
Reviewed-on: https://chromium-review.googlesource.com/1219769Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590419}
parent b198076a
......@@ -320,20 +320,20 @@ namespace time_internal {
template<class TimeClass>
class TimeBase {
public:
static const int64_t kHoursPerDay = 24;
static const int64_t kMillisecondsPerSecond = 1000;
static const int64_t kMillisecondsPerDay =
static constexpr int64_t kHoursPerDay = 24;
static constexpr int64_t kMillisecondsPerSecond = 1000;
static constexpr int64_t kMillisecondsPerDay =
kMillisecondsPerSecond * 60 * 60 * kHoursPerDay;
static const int64_t kMicrosecondsPerMillisecond = 1000;
static const int64_t kMicrosecondsPerSecond =
static constexpr int64_t kMicrosecondsPerMillisecond = 1000;
static constexpr int64_t kMicrosecondsPerSecond =
kMicrosecondsPerMillisecond * kMillisecondsPerSecond;
static const int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60;
static const int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60;
static const int64_t kMicrosecondsPerDay =
static constexpr int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60;
static constexpr int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60;
static constexpr int64_t kMicrosecondsPerDay =
kMicrosecondsPerHour * kHoursPerDay;
static const int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7;
static const int64_t kNanosecondsPerMicrosecond = 1000;
static const int64_t kNanosecondsPerSecond =
static constexpr int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7;
static constexpr int64_t kNanosecondsPerMicrosecond = 1000;
static constexpr int64_t kNanosecondsPerSecond =
kNanosecondsPerMicrosecond * kMicrosecondsPerSecond;
// Returns true if this object has not been initialized.
......
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