wip: string/date/time

This commit is contained in:
2022-09-15 09:39:06 +08:00
parent 41f51bacc5
commit 32a41545de
8 changed files with 45 additions and 16 deletions
+1 -3
View File
@@ -51,8 +51,6 @@ namespace types {
using namespace chrono;
string date_t::toString() const {
uint32_t curr_v = val;
tm;
time_t;
return string() + string("/") + string() + string("/") + string();
}
string time_t::toString() const {
@@ -71,7 +69,7 @@ string base62uuid(int l = 8) {
static mt19937_64 engine(chrono::system_clock::now().time_since_epoch().count());
static uniform_int_distribution<uint64_t> u(0x10000, 0xfffff);
uint64_t uuid = (u(engine) << 32ull) + (chrono::system_clock::now().time_since_epoch().count() & 0xffffffff);
printf("%p\n", uuid);
printf("%llu\n", uuid);
string ret;
while (uuid && l-- >= 0) {
ret = string("") + base62alp[uuid % 62] + ret;
+4 -1
View File
@@ -1,4 +1,5 @@
#pragma once
#ifndef __AQ_PCH_H__
#define __AQ_PCH_H__
#include "libaquery.h"
#include "aggregations.h"
@@ -15,3 +16,5 @@
#include <fcntl.h>
#include <sys/mman.h>
#endif
#endif
+14 -1
View File
@@ -227,12 +227,25 @@ int dll_main(int argc, char** argv, Context* cxt){
}
int launcher(int argc, char** argv){
#ifdef _WIN32
constexpr char sep = '\\';
#else
constexpr char sep = '/';
#endif
std::string str = " ";
std::string pwd = "";
if (argc > 0)
pwd = argv[0];
auto pos = pwd.find_last_of(sep);
if (pos == std::string::npos)
pos = 0;
pwd = pwd.substr(0, pos);
for (int i = 1; i < argc; i++){
str += argv[i];
str += " ";
}
str = std::string("python3 prompt.py ") + str;
str = std::string("cd ") + pwd + std::string("&& python3 ./prompt.py ") + str;
return system(str.c_str());
}
+1 -1
View File
@@ -105,7 +105,7 @@ ThreadPool::ThreadPool(uint32_t n_threads)
current_payload = new payload_t[n_threads];
for (uint32_t i = 0; i < n_threads; ++i){
atomic_init(tf + i, 0b10);
atomic_init(tf + i, static_cast<unsigned char>(0b10));
th[i] = thread(&ThreadPool::daemon_proc, this, i);
}