aboutsummaryrefslogtreecommitdiffstats
path: root/util/draft/date.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/draft/date.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/draft/date.h')
-rw-r--r--util/draft/date.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/util/draft/date.h b/util/draft/date.h
index e3eb616fe5..4130269b0b 100644
--- a/util/draft/date.h
+++ b/util/draft/date.h
@@ -5,8 +5,8 @@
#include <util/generic/string.h>
#include <util/datetime/constants.h>
-#include <ctime>
-
+#include <ctime>
+
// XXX: uses system calls for trivial things. may be very slow therefore.
time_t GetDateStart(time_t ts);
@@ -23,7 +23,7 @@ public:
}
// XXX: wrong. Should be replace with two methods: TodayGmt() and TodayLocal()
- static TDate Today() {
+ static TDate Today() {
return TDate(time(nullptr));
}
@@ -34,7 +34,7 @@ public:
explicit TDate(time_t t);
- time_t GetStart() const {
+ time_t GetStart() const {
return Timestamp;
}
@@ -42,46 +42,46 @@ public:
TString ToStroka(const char* format = "%Y%m%d") const;
- TDate& operator++() {
+ TDate& operator++() {
Timestamp = GetDateStart(Timestamp + 3 * (SECONDS_IN_DAY / 2));
return *this;
}
- TDate& operator--() {
+ TDate& operator--() {
Timestamp = GetDateStart(Timestamp - SECONDS_IN_DAY / 2);
return *this;
}
- TDate& operator+=(unsigned days) {
+ TDate& operator+=(unsigned days) {
Timestamp = GetDateStart(Timestamp + days * SECONDS_IN_DAY + SECONDS_IN_DAY / 2);
return *this;
}
- TDate& operator-=(unsigned days) {
+ TDate& operator-=(unsigned days) {
Timestamp = GetDateStart(Timestamp - days * SECONDS_IN_DAY + SECONDS_IN_DAY / 2);
return *this;
}
- TDate operator+(unsigned days) const {
+ TDate operator+(unsigned days) const {
return TDate(Timestamp + days * SECONDS_IN_DAY + SECONDS_IN_DAY / 2);
}
- TDate operator-(unsigned days) const {
+ TDate operator-(unsigned days) const {
return TDate(Timestamp - days * SECONDS_IN_DAY + SECONDS_IN_DAY / 2);
}
unsigned GetWeekDay() const; // days since Sunday
unsigned GetYear() const;
- unsigned GetMonth() const; // from 01
+ unsigned GetMonth() const; // from 01
unsigned GetMonthDay() const; // from 01
- friend bool operator<(const TDate& left, const TDate& right);
- friend bool operator>(const TDate& left, const TDate& right);
- friend bool operator<=(const TDate& left, const TDate& right);
- friend bool operator>=(const TDate& left, const TDate& right);
- friend bool operator==(const TDate& left, const TDate& right);
- friend int operator-(const TDate& left, const TDate& right);
+ friend bool operator<(const TDate& left, const TDate& right);
+ friend bool operator>(const TDate& left, const TDate& right);
+ friend bool operator<=(const TDate& left, const TDate& right);
+ friend bool operator>=(const TDate& left, const TDate& right);
+ friend bool operator==(const TDate& left, const TDate& right);
+ friend int operator-(const TDate& left, const TDate& right);
friend IInputStream& operator>>(IInputStream& left, TDate& right);
friend IOutputStream& operator<<(IOutputStream& left, const TDate& right);
@@ -89,27 +89,27 @@ public:
Y_DECLARE_PODTYPE(TDate);
-inline bool operator<(const TDate& left, const TDate& right) {
+inline bool operator<(const TDate& left, const TDate& right) {
return left.Timestamp < right.Timestamp;
}
-inline bool operator>(const TDate& left, const TDate& right) {
+inline bool operator>(const TDate& left, const TDate& right) {
return left.Timestamp > right.Timestamp;
}
-inline bool operator<=(const TDate& left, const TDate& right) {
+inline bool operator<=(const TDate& left, const TDate& right) {
return left.Timestamp <= right.Timestamp;
}
-inline bool operator>=(const TDate& left, const TDate& right) {
+inline bool operator>=(const TDate& left, const TDate& right) {
return left.Timestamp >= right.Timestamp;
}
-inline bool operator==(const TDate& left, const TDate& right) {
+inline bool operator==(const TDate& left, const TDate& right) {
return left.Timestamp == right.Timestamp;
}
-inline int operator-(const TDate& left, const TDate& right) {
+inline int operator-(const TDate& left, const TDate& right) {
if (left < right) {
return -(right - left);
}