-#include "t4.h"
-#include "types.h"
-#include "threaded_log.h"
+#include "include/t4.h"
+#include "include/types.h"
+#include "include/debug.h"
using namespace std::chrono;
int tid = global->thread_name_map[thread];
if (tid==0)
tid = global->thread_name_map[thread] = ++global->next_thread_num;
- auto utime = duration_cast<microseconds>(
- system_clock::now().time_since_epoch()).count() % 1000000000;
+ auto utime = (system_clock::now().time_since_epoch() / 1us) % 1000000000;
f << std::setfill('0') << std::dec << std::left << std::setw(9) << utime << " ";
f << std::setfill(' ') << global->log_thread_prefix << std::left << std::setw(2) << tid;
f << " " << std::setw(20) << file << " " << std::setw(18) << func;
lock _log_lock() {
return lock(global->log_mutex);
}
+
+string hex_string(const string & s) {
+ string bytes;
+ for (char ch : s) {
+ bytes.push_back("0123456789abcdef"[(uint8_t)ch >> 4]);
+ bytes.push_back("0123456789abcdef"[(uint8_t)ch & 15]);
+ }
+ return bytes;
+}