1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

integrating the existing state of TON Storage / TON Payments / CPS Fift development branches

This commit is contained in:
ton 2020-05-27 22:10:46 +04:00
parent 040df63c98
commit 4e2624459b
153 changed files with 10760 additions and 1695 deletions

View file

@ -40,6 +40,10 @@ class Time {
// As an alternative we may say that now_cached is a thread local copy of now
return now();
}
static double now_unadjusted();
// Used for testing. After jump_in_future(at) is called, now() >= at.
static void jump_in_future(double at);
};
inline void relax_timeout_at(double *timeout, double new_timeout) {
@ -70,12 +74,15 @@ class Timestamp {
return Timestamp{timeout - td::Clocks::system() + Time::now()};
}
static Timestamp in(double timeout) {
return Timestamp{Time::now_cached() + timeout};
static Timestamp in(double timeout, td::Timestamp now = td::Timestamp::now_cached()) {
return Timestamp{now.at() + timeout};
}
bool is_in_past(td::Timestamp now) const {
return at_ <= now.at();
}
bool is_in_past() const {
return at_ <= Time::now_cached();
return is_in_past(now_cached());
}
explicit operator bool() const {
@ -111,6 +118,10 @@ class Timestamp {
}
};
inline bool operator<(const Timestamp &a, const Timestamp &b) {
return a.at() < b.at();
}
template <class StorerT>
void store(const Timestamp &timestamp, StorerT &storer) {
storer.store_binary(timestamp.at() - Time::now() + Clocks::system());