aboutsummaryrefslogtreecommitdiff
path: root/libbrep/common.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep/common.hxx')
-rw-r--r--libbrep/common.hxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 1433c8c..4be9ce9 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -141,6 +141,20 @@ namespace brep
std::chrono::nanoseconds (*(?)))) \
: brep::optional_timestamp ())
+ #pragma db map type(duration) as(uint64_t) \
+ to(std::chrono::duration_cast<std::chrono::nanoseconds> (?).count ()) \
+ from(brep::duration (std::chrono::nanoseconds (?)))
+
+ using optional_duration = optional<duration>;
+
+ #pragma db map type(optional_duration) as(brep::optional_uint64) \
+ to((?) \
+ ? std::chrono::duration_cast<std::chrono::nanoseconds> (*(?)).count () \
+ : brep::optional_uint64 ()) \
+ from((?) \
+ ? brep::duration (std::chrono::nanoseconds (*(?))) \
+ : brep::optional_duration ())
+
// version
//
using bpkg::version;