Skip to content

Commit d64a2c0

Browse files
committed
get rid of gettickcount
1 parent f8874bf commit d64a2c0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

GUI/host/textthread.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void TextThread::Push(BYTE* data, int length)
6363
else if (auto converted = StringToWideString(std::string((char*)data, length), hp.codepage ? hp.codepage : Host::defaultCodepage)) buffer.append(converted.value());
6464
else Host::AddConsoleOutput(INVALID_CODEPAGE);
6565
if (hp.type & FULL_STRING) buffer.push_back(L'\n');
66-
lastPushTime = GetTickCount();
66+
lastPushTime = GetTickCount64();
6767

6868
if (filterRepetition)
6969
{
@@ -87,7 +87,7 @@ void TextThread::Push(const wchar_t* data)
8787
{
8888
std::scoped_lock lock(bufferMutex);
8989
// not sure if this should filter repetition
90-
lastPushTime = GetTickCount();
90+
lastPushTime = GetTickCount64();
9191
buffer += data;
9292
}
9393

@@ -110,7 +110,7 @@ void TextThread::Flush()
110110

111111
std::scoped_lock lock(bufferMutex);
112112
if (buffer.empty()) return;
113-
if (buffer.size() > maxBufferSize || GetTickCount() - lastPushTime > flushDelay)
113+
if (buffer.size() > maxBufferSize || GetTickCount64() - lastPushTime > flushDelay)
114114
{
115115
AddSentence(std::move(buffer));
116116
buffer.clear();

GUI/host/textthread.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TextThread
3636
BYTE leadByte = 0;
3737
std::unordered_set<wchar_t> repeatingChars;
3838
std::mutex bufferMutex;
39-
DWORD lastPushTime = 0;
39+
DWORD64 lastPushTime = 0;
4040
Synchronized<std::vector<std::wstring>> queuedSentences;
4141
struct TimerDeleter { void operator()(HANDLE h) { DeleteTimerQueueTimer(NULL, h, INVALID_HANDLE_VALUE); } };
4242
AutoHandle<TimerDeleter> timer = NULL;

extensions/translatewrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
154154
public:
155155
bool Request()
156156
{
157-
DWORD current = GetTickCount(), token;
157+
DWORD64 current = GetTickCount64(), token;
158158
while (tokens.try_pop(token)) if (token > current - rateLimitTimespan)
159159
{
160160
tokens.push(token); // popped one too many
@@ -165,7 +165,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
165165
}
166166

167167
private:
168-
concurrency::concurrent_priority_queue<DWORD, std::greater<DWORD>> tokens;
168+
concurrency::concurrent_priority_queue<DWORD64, std::greater<DWORD64>> tokens;
169169
} rateLimiter;
170170

171171
auto Trim = [](std::wstring& text)

0 commit comments

Comments
 (0)