@@ -620,12 +620,12 @@ ABSL_ATTRIBUTE_CONST_FUNCTION Duration Hours(T n) {
620
620
//
621
621
// absl::Duration d = absl::Milliseconds(1500);
622
622
// int64_t isec = absl::ToInt64Seconds(d); // isec == 1
623
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Nanoseconds (Duration d);
624
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Microseconds (Duration d);
625
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Milliseconds (Duration d);
626
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Seconds (Duration d);
627
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Minutes (Duration d);
628
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Hours (Duration d);
623
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Nanoseconds (Duration d);
624
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Microseconds (Duration d);
625
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Milliseconds (Duration d);
626
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Seconds (Duration d);
627
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Minutes (Duration d);
628
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Hours (Duration d);
629
629
630
630
// ToDoubleNanoseconds()
631
631
// ToDoubleMicroseconds()
@@ -1864,7 +1864,7 @@ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr Time FromTimeT(time_t t) {
1864
1864
return time_internal::FromUnixDuration (Seconds (t));
1865
1865
}
1866
1866
1867
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Nanoseconds (Duration d) {
1867
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Nanoseconds (Duration d) {
1868
1868
if (time_internal::GetRepHi (d) >= 0 &&
1869
1869
time_internal::GetRepHi (d) >> 33 == 0 ) {
1870
1870
return (time_internal::GetRepHi (d) * 1000 * 1000 * 1000 ) +
@@ -1873,7 +1873,8 @@ ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Nanoseconds(Duration d) {
1873
1873
return d / Nanoseconds (1 );
1874
1874
}
1875
1875
1876
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Microseconds (Duration d) {
1876
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Microseconds (
1877
+ Duration d) {
1877
1878
if (time_internal::GetRepHi (d) >= 0 &&
1878
1879
time_internal::GetRepHi (d) >> 43 == 0 ) {
1879
1880
return (time_internal::GetRepHi (d) * 1000 * 1000 ) +
@@ -1883,7 +1884,8 @@ ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Microseconds(Duration d) {
1883
1884
return d / Microseconds (1 );
1884
1885
}
1885
1886
1886
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Milliseconds (Duration d) {
1887
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Milliseconds (
1888
+ Duration d) {
1887
1889
if (time_internal::GetRepHi (d) >= 0 &&
1888
1890
time_internal::GetRepHi (d) >> 53 == 0 ) {
1889
1891
return (time_internal::GetRepHi (d) * 1000 ) +
@@ -1893,21 +1895,21 @@ ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Milliseconds(Duration d) {
1893
1895
return d / Milliseconds (1 );
1894
1896
}
1895
1897
1896
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Seconds (Duration d) {
1898
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Seconds (Duration d) {
1897
1899
int64_t hi = time_internal::GetRepHi (d);
1898
1900
if (time_internal::IsInfiniteDuration (d)) return hi;
1899
1901
if (hi < 0 && time_internal::GetRepLo (d) != 0 ) ++hi;
1900
1902
return hi;
1901
1903
}
1902
1904
1903
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Minutes (Duration d) {
1905
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Minutes (Duration d) {
1904
1906
int64_t hi = time_internal::GetRepHi (d);
1905
1907
if (time_internal::IsInfiniteDuration (d)) return hi;
1906
1908
if (hi < 0 && time_internal::GetRepLo (d) != 0 ) ++hi;
1907
1909
return hi / 60 ;
1908
1910
}
1909
1911
1910
- ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t ToInt64Hours (Duration d) {
1912
+ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Hours (Duration d) {
1911
1913
int64_t hi = time_internal::GetRepHi (d);
1912
1914
if (time_internal::IsInfiniteDuration (d)) return hi;
1913
1915
if (hi < 0 && time_internal::GetRepLo (d) != 0 ) ++hi;
0 commit comments