Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"capabilities": [],
"nix": {
"packages": {
"runtime": ["postgresql", "nlohmann_json"]
"runtime": ["libpq", "nlohmann_json"]
},
"external_libraries": [
{
Expand Down
11 changes: 8 additions & 3 deletions src/delivery_module_plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "delivery_module_plugin.h"
#include <chrono>
#include <cstdio>
#include <ctime>
#include <memory>
Expand Down Expand Up @@ -34,9 +35,13 @@ std::vector<uint8_t> base64Decode(const std::string& encoded) {
}

int64_t currentTimestampNs() {
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
return static_cast<int64_t>(ts.tv_sec) * 1000000000LL + static_cast<int64_t>(ts.tv_nsec);
// std::chrono rather than clock_gettime(CLOCK_REALTIME): the POSIX call is
// not available on mingw (neither the function nor CLOCK_REALTIME is
// declared), which broke the Windows cross-build. system_clock is the
// portable spelling of the same wall-clock reading.
return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
}
} // namespace

Expand Down