summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-03-01 21:54:33 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2020-03-10 21:47:29 +0100
commit9076a13c78cf64a6afafe98817aed31feda568b1 (patch)
tree2ee915d7708d54035727f7cc3aebe8b10a113120 /include
parent240edf7494745dc4df2128644fe5c1a73ec2d513 (diff)
Date and time record item type
Diffstat (limited to 'include')
-rw-r--r--include/erebos/storage.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/erebos/storage.h b/include/erebos/storage.h
index 0859dc8..b6595b6 100644
--- a/include/erebos/storage.h
+++ b/include/erebos/storage.h
@@ -1,6 +1,7 @@
#pragma once
#include <array>
+#include <chrono>
#include <cstring>
#include <filesystem>
#include <memory>
@@ -156,6 +157,18 @@ protected:
Ref(const std::shared_ptr<const Priv> p): PartialRef(p) {}
};
+struct ZonedTime
+{
+ explicit ZonedTime(std::string);
+ ZonedTime(std::chrono::system_clock::time_point t): time(t), zone(0) {}
+ explicit operator std::string() const;
+
+ static ZonedTime now();
+
+ std::chrono::system_clock::time_point time;
+ std::chrono::minutes zone; // zone offset
+};
+
struct UUID
{
explicit UUID(std::string);
@@ -184,6 +197,7 @@ public:
int,
std::string,
std::vector<uint8_t>,
+ ZonedTime,
UUID,
typename S::Ref,
UnknownType> Variant;
@@ -204,6 +218,7 @@ public:
std::optional<int> asInteger() const;
std::optional<std::string> asText() const;
std::optional<std::vector<uint8_t>> asBinary() const;
+ std::optional<ZonedTime> asDate() const;
std::optional<UUID> asUUID() const;
std::optional<typename S::Ref> asRef() const;
std::optional<UnknownType> asUnknown() const;