| 23 | using namespace std::chrono_literals; |
| 24 | |
| 25 | static int SanitizeAge(std::optional<int64_t> Age) |
| 26 | { |
| 27 | // A year is of course pi*10**7 seconds. |
| 28 | if(!(Age && 0 <= *Age && *Age < 31415927)) |
| 29 | { |
| 30 | return 31415927; |
| 31 | } |
| 32 | return *Age; |
| 33 | } |
| 34 | |
| 35 | // Classify HTTP responses into buckets, treat 15 seconds as fresh, 1 minute as |
| 36 | // less fresh, etc. This ensures that differences in the order of seconds do |