aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime/base.h
diff options
context:
space:
mode:
authorpozhilov <pozhilov@yandex-team.ru>2022-02-10 16:49:27 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:27 +0300
commit23bf1d16dddf213a6aa8e8d5c8621e1242a1f118 (patch)
treeed030ff443eb83431f11e53b6460b1b73d035412 /util/datetime/base.h
parent7156b3713e77ce36387436e5558320917698b7a2 (diff)
downloadydb-23bf1d16dddf213a6aa8e8d5c8621e1242a1f118.tar.gz
Restoring authorship annotation for <pozhilov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/datetime/base.h')
-rw-r--r--util/datetime/base.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 5e902b8f63..6a8710b3a6 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -45,7 +45,7 @@ class TDateTimeParseException: public yexception {
const int DATE_BUF_LEN = 4 + 2 + 2 + 1; // [YYYYMMDD*]
-constexpr long seconds(const struct tm& theTm) {
+constexpr long seconds(const struct tm& theTm) {
return 60 * (60 * theTm.tm_hour + theTm.tm_min) + theTm.tm_sec;
}
@@ -78,7 +78,7 @@ bool ParseHTTPDateTime(const char* date, size_t dateLen, time_t& utcTime);
bool ParseX509ValidityDateTime(const char* date, time_t& utcTime);
bool ParseX509ValidityDateTime(const char* date, size_t dateLen, time_t& utcTime);
-constexpr long TVdiff(timeval r1, timeval r2) {
+constexpr long TVdiff(timeval r1, timeval r2) {
return (1000000 * (r2.tv_sec - r1.tv_sec) + (r2.tv_usec - r1.tv_usec));
}
@@ -264,9 +264,9 @@ public:
return TDuration(us);
}
- /* noexcept(false) as conversion from T might throw, for example FromString("abc") */
+ /* noexcept(false) as conversion from T might throw, for example FromString("abc") */
template <typename T>
- static constexpr TDuration MilliSeconds(T ms) noexcept(false) {
+ static constexpr TDuration MilliSeconds(T ms) noexcept(false) {
return MicroSeconds((ui64)(typename NDateTimeHelpers::TPrecisionHelper<T>::THighPrecision(ms) * 1000));
}
@@ -279,7 +279,7 @@ public:
/// DeadLineFromTimeOut
inline TInstant ToDeadLine() const;
- constexpr TInstant ToDeadLine(TInstant now) const;
+ constexpr TInstant ToDeadLine(TInstant now) const;
static constexpr TDuration Max() noexcept {
return TDuration(::Max<TValue>());
@@ -289,9 +289,9 @@ public:
return TDuration();
}
- /* noexcept(false) as conversion from T might throw, for example FromString("abc") */
+ /* noexcept(false) as conversion from T might throw, for example FromString("abc") */
template <typename T>
- static constexpr TDuration Seconds(T s) noexcept(false) {
+ static constexpr TDuration Seconds(T s) noexcept(false) {
return MilliSeconds(typename NDateTimeHelpers::TPrecisionHelper<T>::THighPrecision(s) * 1000);
}
@@ -571,7 +571,7 @@ namespace NPrivate {
struct TPrintableLocalTime {
TInstant MomentToPrint;
- constexpr explicit TPrintableLocalTime(TInstant momentToPrint)
+ constexpr explicit TPrintableLocalTime(TInstant momentToPrint)
: MomentToPrint(momentToPrint)
{
}
@@ -633,17 +633,17 @@ static constexpr bool operator>=(const TTimeBase<S>& l, const TTimeBase<S>& r) n
namespace NDateTimeHelpers {
template <typename T>
- static constexpr T SumWithSaturation(T a, T b) {
+ static constexpr T SumWithSaturation(T a, T b) {
static_assert(!std::numeric_limits<T>::is_signed, "expect !std::numeric_limits<T>::is_signed");
- return Max<T>() - a < b ? Max<T>() : a + b;
+ return Max<T>() - a < b ? Max<T>() : a + b;
}
template <typename T>
- static constexpr T DiffWithSaturation(T a, T b) {
+ static constexpr T DiffWithSaturation(T a, T b) {
static_assert(!std::numeric_limits<T>::is_signed, "expect !std::numeric_limits<T>::is_signed");
- return a < b ? 0 : a - b;
+ return a < b ? 0 : a - b;
}
}
@@ -803,11 +803,11 @@ constexpr double operator/(const TDuration& x, const TDuration& y) noexcept {
return static_cast<double>(x.GetValue()) / static_cast<double>(y.GetValue());
}
-inline TInstant TDuration::ToDeadLine() const {
+inline TInstant TDuration::ToDeadLine() const {
return ToDeadLine(TInstant::Now());
}
-constexpr TInstant TDuration::ToDeadLine(TInstant now) const {
+constexpr TInstant TDuration::ToDeadLine(TInstant now) const {
return now + *this;
}