#include <ctime>
#include <err.h>
#include <errno.h>
#include <fstream>
#include <map>
#include <msgpack.hpp>
#include <sys/stat.h>
#include <utility>
static const struct timespec timestamp32min = {.tv_sec = 0}; static const struct timespec timestamp32mid = {.tv_sec = 1765301648}; static const struct timespec timestamp32max = {.tv_sec = 0x00000000FFFFFFFF};
static const struct timespec timestamp64min = {.tv_sec = 0, .tv_nsec = 1}; static const struct timespec timestamp64mid = {.tv_sec = 1765301648, .tv_nsec = 500000000}; static const struct timespec timestamp64max = {.tv_sec = 0x00000003FFFFFFFF, .tv_nsec = 999'999'999};
static const struct timespec timestamp96nin = {.tv_sec = -1, .tv_nsec = 999'999'999}; static const struct timespec timestamp962in = {.tv_sec = -2, .tv_nsec = 999'999'999}; static const struct timespec timestamp96nid = {.tv_sec = -188852558399, .tv_nsec = 500000000}; static const struct timespec timestamp96nax = {.tv_sec = -377705116800, .tv_nsec = 0};
static const struct timespec timestamp96min = {.tv_sec = 0x00000003FFFFFFFF + 1, .tv_nsec = 0}; static const struct timespec timestamp96mid = {.tv_sec = 135291084991, .tv_nsec = 500000000}; static const struct timespec timestamp96max = {.tv_sec = 253402214400 + 24 * 60 * 60 - 1, .tv_nsec = 999'999'999};
static const std::pair<const char *, struct timespec> timespecs[] = {
{"timestamp32min", timestamp32min}, {"timestamp32mid", timestamp32mid}, {"timestamp32max", timestamp32max}, {"timestamp64min", timestamp64min}, {"timestamp64mid", timestamp64mid}, {"timestamp64max", timestamp64max}, {"timestamp96nin", timestamp96nin}, {"timestamp962in", timestamp962in}, {"timestamp96nid", timestamp96nid}, {"timestamp96nax", timestamp96nax},
{"timestamp96min", timestamp96min}, {"timestamp96mid", timestamp96mid}, {"timestamp96max", timestamp96max}};
int main(int, const char * const * argv) {
auto destdir = argv[1] ?: ".";
if((mkdir(destdir, 0777) == -1 && errno != EEXIST) || chdir(destdir))
err(1, "%s", destdir);
for(auto [name, ts] : timespecs)
for(auto trunc : {""}) {
{
std::ofstream outf{std::string{name} + trunc + ".msgpack"};
msgpack::pack(outf, ts);
}
}
}