mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Basic consensus implementation (#45)
Consensus for user connections, user inputs, contract outputs and time.
This commit is contained in:
11
src/util.cpp
11
src/util.cpp
@@ -1,6 +1,7 @@
|
||||
#include <string>
|
||||
#include <sodium.h>
|
||||
#include <sstream>
|
||||
#include <chrono>
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
namespace util
|
||||
@@ -52,6 +53,16 @@ int hex2bin(unsigned char *decodedbuf, size_t decodedbuf_len, std::string_view h
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current time in UNIX epoch milliseconds.
|
||||
*/
|
||||
int64_t get_epoch_milliseconds()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch())
|
||||
.count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two version strings in the format of "1.12.3".
|
||||
* v1 < v2 -> returns -1
|
||||
|
||||
Reference in New Issue
Block a user