2021-01-17 21:45:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
namespace BareMinimumCrypto {
|
|
|
|
const int64_t about_1_week = (int64_t)7 * 86400;
|
|
|
|
const int64_t about_3_months = (int64_t)105 * 86400;
|
|
|
|
const int64_t about_1_year = (int64_t)365 * 86400;
|
|
|
|
|
2021-01-17 23:31:28 +00:00
|
|
|
struct Instant {
|
|
|
|
// Seconds since Unix epoch
|
|
|
|
int64_t x;
|
|
|
|
|
|
|
|
Instant (int64_t x);
|
|
|
|
static Instant now ();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TimeRange {
|
|
|
|
int64_t not_before;
|
|
|
|
int64_t not_after;
|
|
|
|
|
|
|
|
bool contains (Instant x) const;
|
|
|
|
int64_t duration () const;
|
|
|
|
|
|
|
|
static TimeRange from_start_and_dur (Instant start, int64_t dur);
|
|
|
|
};
|
2021-01-17 21:53:04 +00:00
|
|
|
|
|
|
|
int test_time ();
|
2021-01-17 21:45:59 +00:00
|
|
|
}
|