提交 482f6e77 编写于 作者: A amchii

pre-commit忽略生成的_i.h,_p.c文件

上级 98fcc768
......@@ -14,11 +14,15 @@ repos:
- -i
- --style=file
- --fallback-style=none
files: |
(?x)^(
.*?\.cpp|
.*?\.c|
.*?\.h
)
files: |
exclude: |
(?x)^(
.*?\.cpp|
.*?\.c|
.*?\.h
)
\ No newline at end of file
.*?_i\.h|
.*?_p\.c
)
此差异已折叠。
此差异已折叠。
......@@ -21,7 +21,7 @@ public:
{
return hr;
}
T *pThis = static_cast<T *>(this);
T *pThis = dynamic_cast<T *>(this);
if (WxPidToEventCookie.count(pid) == 0)
{
return hr;
......
#pragma once
#include <set>
#include <utility>
#include <chrono>
#define CHRONO std::chrono
......@@ -21,6 +20,7 @@ public:
ExpireSet(ull interval)
{
this->interval = interval;
this->expires_at = 0;
}
bool CheckIfDuplicatedAndAdd(ull id)
{
......@@ -35,18 +35,19 @@ public:
private:
std::set<ull> ids;
std::pair<ull, ull> p;
ull expires_at;
void Add(ull id)
{
// 毫秒
auto now = CHRONO::time_point_cast<CHRONO::milliseconds>(CHRONO::system_clock::now());
if (p.second < now.time_since_epoch().count())
auto now_ts = CHRONO::time_point_cast<CHRONO::milliseconds>(CHRONO::system_clock::now()).time_since_epoch().count();
#pragma warning(disable : 4018)
if (expires_at < now_ts)
{
ids.clear();
p.first = now.time_since_epoch().count();
p.second = p.first + interval;
expires_at = now_ts + interval;
}
#pragma warning(default : 4018)
ids.insert(id);
}
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册