Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions TTProxy/ProxyWSockHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class ProxyWSockHook {
in_addr addr;
struct in6_addr addr6;
char* buffer;
DWORD time;
ULONGLONG time;
ConnectionInfo(ProxyInfo& proxy, String realhost):proxy(proxy), realhost(realhost), buffer(NULL) {
}
~ConnectionInfo() {
Expand Down Expand Up @@ -664,7 +664,7 @@ class ProxyWSockHook {
ConnectionInfo* info = table.get(url);
::LeaveCriticalSection(&section);
if (info != NULL) {
info->time = ::GetTickCount();
info->time = ::GetTickCount64();
return info;
}
ProxyInfo proxy;
Expand All @@ -688,8 +688,8 @@ class ProxyWSockHook {
}
}
if (i >= countof(list)) {
DWORD now = ::GetTickCount();
DWORD max = 0;
ULONGLONG now = ::GetTickCount64();
ULONGLONG max = 0;
int index = -1;
for (i = 0; i < countof(list); i++) {
if (list[i] != NULL) {
Expand All @@ -709,7 +709,7 @@ class ProxyWSockHook {
info->addr6.s6_addr[11] = 0xff;
info->addr6.s6_addr[15] = i + 1;

info->time = ::GetTickCount();
info->time = ::GetTickCount64();
return info;
}
};
Expand Down
37 changes: 36 additions & 1 deletion doc/en/html/macro/command/uptime.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ <h1>uptime</h1>
Gets System Up Time. <em>(version 4.81 or later)</em>
</p>

<h2>1) Format 1</h2>

<pre class="macro-syntax">
uptime &lt;intvar&gt;
</pre>

<h2>2) Format 2</h2>

<pre class="macro-syntax">
uptime &lt;secvar&gt; &lt;msecvar&gt;
</pre>

<h2>Remarks</h2>

<h3>Format 1</h3>

<p>
Retrieves the number of milliseconds that have elapsed since the Windows OS was started,
and then stores the value into the &lt;intvar&gt; variable.
Expand All @@ -32,11 +42,29 @@ <h2>Remarks</h2>
The time wraps around to zero if the system is run continuously for 49.7 days.
</p>

<h3>Format 2</h3>

<p>
Retrieves the number of milliseconds that have elapsed since the Windows OS was started
using <code>GetTickCount64()</code>, and then stores the following values:
</p>

<dl>
<dt>&lt;secvar&gt;</dt>
<dd>Windows OS uptime in seconds (<code>GetTickCount64() / 1000</code>)</dd>
<dt>&lt;msecvar&gt;</dt>
<dd>Sub-second portion of the uptime in milliseconds (<code>GetTickCount64() % 1000</code>)</dd>
</dl>

<p>
Both &lt;secvar&gt; and &lt;msecvar&gt; must be integer variables.
</p>


<h2>Example</h2>

<pre class="macro-example">
; How to get the uptime in Windows
; Format 1: How to get the uptime in Windows
uptime var
day = var / 86400000
var = var % 86400000
Expand All @@ -61,5 +89,12 @@ <h2>Example</h2>
messagebox str "running time"
</pre>

<pre class="macro-example">
; Format 2: Get uptime as seconds and milliseconds
uptime sec msec
sprintf2 str "System Up Time: %d.%03d seconds" sec msec
messagebox str "uptime"
</pre>

</body>
</html>
38 changes: 36 additions & 2 deletions doc/ja/html/macro/command/uptime.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,21 @@ <h1>uptime</h1>
OSの稼働時間を取得する。<em>(バージョン4.81以降)</em>
</p>

<h2>1) 形式1</h2>

<pre class="macro-syntax">
uptime &lt;intvar&gt;
</pre>

<h2>解説</h2>
<h2>2) 形式2</h2>

<pre class="macro-syntax">
uptime &lt;secvar&gt; &lt;msecvar&gt;
</pre>

<h2>説明</h2>

<h3>形式1</h3>

<p>
Windows OSの稼働時間(ミリ秒)を &lt;intvar&gt; に格納する。
Expand All @@ -31,11 +41,28 @@ <h1>uptime</h1>
※稼働時間が49日を経過すると、0に戻る。
</p>

<h3>形式2</h3>

<p>
<code>GetTickCount64()</code> を使ってWindows OSの稼働時間を取得し、下記の値を格納する。
</p>

<dl>
<dt>&lt;secvar&gt;</dt>
<dd>Windows OSの稼働時間(秒単位)(<code>GetTickCount64() / 1000</code>)</dd>
<dt>&lt;msecvar&gt;</dt>
<dd>稼働時間の1秒未満の部分(ミリ秒単位)(<code>GetTickCount64() % 1000</code>)</dd>
</dl>

<p>
&lt;secvar&gt; と &lt;msecvar&gt; はともに整数型変数でなければならない。
</p>


<h2>例</h2>

<pre class="macro-example">
; How to get the uptime in Windows
; 形式1: Windowsの稼働時間を取得する例
uptime var
day = var / 86400000
var = var % 86400000
Expand All @@ -60,5 +87,12 @@ <h1>uptime</h1>
messagebox str "running time"
</pre>

<pre class="macro-example">
; 形式2: 稼働時間を秒とミリ秒で取得する例
uptime sec msec
sprintf2 str "System Up Time: %d.%03d seconds" sec msec
messagebox str "uptime"
</pre>

</body>
</html>
2 changes: 1 addition & 1 deletion teraterm/common/compat_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static HWND WINAPI GetConsoleWindowLocal(void)
}

// Format a "unique" NewWindowTitle.
wsprintfA(pszNewWindowTitle, "%d/%d", GetTickCount(), GetCurrentProcessId());
wsprintfA(pszNewWindowTitle, "%I64u/%d", GetTickCount64(), GetCurrentProcessId());

// Change current window title.
SetConsoleTitleA(pszNewWindowTitle);
Expand Down
17 changes: 9 additions & 8 deletions teraterm/common/dlglib.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,14 @@ void SetDlgPercent(HWND HDlg, int id_Item, int id_Progress, LONG a, LONG b, int
}
}

void SetDlgTime(HWND HDlg, int id_Item, DWORD stime, int bytes)
void SetDlgTime(HWND HDlg, int id_Item, ULONGLONG stime, int bytes)
{
static int prev_elapsed;
int elapsed, rate;
static ULONGLONG prev_elapsed;
ULONGLONG elapsed;
int rate;
wchar_t buff[64];

elapsed = (GetTickCount() - stime) / 1000;
elapsed = (GetTickCount64() - stime) / 1000;

if (elapsed == 0) {
prev_elapsed = 0;
Expand All @@ -172,15 +173,15 @@ void SetDlgTime(HWND HDlg, int id_Item, DWORD stime, int bytes)
}
prev_elapsed = elapsed;

rate = bytes / elapsed;
rate = (int)(bytes / elapsed);
if (rate < 1200) {
_snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%d:%02d (%dBytes/s)", elapsed / 60, elapsed % 60, rate);
_snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%llu:%02llu (%dBytes/s)", elapsed / 60, elapsed % 60, rate);
}
else if (rate < 1200000) {
_snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%d:%02d (%d.%02dKB/s)", elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100);
_snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%llu:%02llu (%d.%02dKB/s)", elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100);
}
else {
_snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%d:%02d (%d.%02dMB/s)", elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100);
_snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%llu:%02llu (%d.%02dMB/s)", elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100);
}

SetDlgItemTextW(HDlg, id_Item, buff);
Expand Down
2 changes: 1 addition & 1 deletion teraterm/common/dlglib.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void SetRB(HWND HDlg, int R, int FirstId, int LastId);
void GetRB(HWND HDlg, LPWORD R, int FirstId, int LastId);
void SetDlgNum(HWND HDlg, int id_Item, LONG Num);
void SetDlgPercent(HWND HDlg, int id_Item, int id_Progress, LONG a, LONG b, int *prog);
void SetDlgTime(HWND HDlg, int id_Item, DWORD elapsed, int bytes);
void SetDlgTime(HWND HDlg, int id_Item, ULONGLONG elapsed, int bytes);
void SetDropDownList(HWND HDlg, int Id_Item, const char *List[], int nsel);
void SetDropDownListW(HWND HDlg, int Id_Item, const wchar_t *List[], int nsel);
LONG GetCurSel(HWND HDlg, int Id_Item);
Expand Down
14 changes: 7 additions & 7 deletions teraterm/common/ttlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,24 +956,24 @@ char *mctimelocal(const char *format, BOOL utc_flag)
* @return 邨碁℃譎る俣縺ョ譁�ュ怜�
* 荳崎ヲ√↓縺ェ縺」縺溘ifree()縺吶k縺薙→
*/
char *strelapsed(DWORD start_time)
char *strelapsed(ULONGLONG start_time)
{
size_t sizeof_strtime = 20;
char *strtime = malloc(sizeof_strtime);
int days, hours, minutes, seconds, msecs;
DWORD delta = GetTickCount() - start_time;
ULONGLONG delta = GetTickCount64() - start_time;

msecs = delta % 1000;
msecs = (int)(delta % 1000);
delta /= 1000;

seconds = delta % 60;
seconds = (int)(delta % 60);
delta /= 60;

minutes = delta % 60;
minutes = (int)(delta % 60);
delta /= 60;

hours = delta % 24;
days = delta / 24;
hours = (int)(delta % 24);
days = (int)(delta / 24);

_snprintf_s(strtime, sizeof_strtime, _TRUNCATE,
"%d %02d:%02d:%02d.%03d",
Expand Down
2 changes: 1 addition & 1 deletion teraterm/common/ttlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ DllExport BOOL HasMultiMonitorSupport();
DllExport BOOL HasDnsQuery();
DllExport BOOL HasBalloonTipSupport();
DllExport char *mctimelocal(const char *format, BOOL utc_flag);
char *strelapsed(DWORD start_time);
char *strelapsed(ULONGLONG start_time);

void b64encode(PCHAR dst, int dsize, PCHAR src, int len);
DllExport int b64decode(PCHAR dst, int dsize, PCHAR src);
Expand Down
2 changes: 1 addition & 1 deletion teraterm/common/tttypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ typedef struct {

void *NotifyIcon;

DWORD ConnectedTime;
ULONGLONG ConnectedTime;

void (*Log1Byte)(BYTE b);
void (*Log1Bin)(BYTE b);
Expand Down
8 changes: 4 additions & 4 deletions teraterm/teraterm/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static BOOL BoxSelect; // TRUE=遏ゥ蠖「驕ク謚 / FALSE=陦碁∈謚
static POINT ClickCell; // 繧ッ繝ェ繝�け縺励◆譁�ュ幼ell
static POINT SelectStartOld; // 謠冗判縺励◆驕ク謚樣伜沺縲《tart
static POINT SelectEndOld; // 謠冗判縺励◆驕ク謚樣伜沺縲‘nd
static DWORD SelectStartTime;
static ULONGLONG SelectStartTime;
static POINT DblClkStart;
static POINT DblClkEnd;

Expand Down Expand Up @@ -4749,7 +4749,7 @@ void BuffStartSelect(int Xw, int Yw, BOOL Box, BOOL Shift)
Selected = FALSE;

// 驕ク謚樣幕蟋九ぎ繝シ繝
SelectStartTime = GetTickCount();
SelectStartTime = GetTickCount64();
Selecting = FALSE;

// push菴咲スョ
Expand Down Expand Up @@ -4778,7 +4778,7 @@ void BuffChangeSelect(int Xw, int Yw, int NClick)

if (!Selecting) {
// 驕ク謚槭ぎ繝シ繝?
if (GetTickCount() - SelectStartTime < ts.SelectStartDelay) {
if (GetTickCount64() - SelectStartTime < ts.SelectStartDelay) {
// 繧ャ繝シ繝我クュ
return;
}
Expand Down Expand Up @@ -4889,7 +4889,7 @@ void BuffEndSelect(int Xw, int Yw)
(void)Xw;
(void)Yw;
if (!Selecting) {
if (GetTickCount() - SelectStartTime < ts.SelectStartDelay) {
if (GetTickCount64() - SelectStartTime < ts.SelectStartDelay) {
// 繧ャ繝シ繝画凾髢謎サ・蜀�↑繧
// 驕ク謚樣伜沺隗」髯、
SelectEnd = SelectStart;
Expand Down
2 changes: 1 addition & 1 deletion teraterm/teraterm/commlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ void CommStart(PComVar cv, LONG lParam, PTTSet ts)
break;
}
cv->Ready = TRUE;
cv->ConnectedTime = GetTickCount();
cv->ConnectedTime = GetTickCount64();
}

BOOL CommCanClose(PComVar cv)
Expand Down
4 changes: 2 additions & 2 deletions teraterm/teraterm/filesys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef struct {
LONG FileSize; // uint64_t FileSize; TODO
LONG ByteCount; // uint64_t ByteCount;

DWORD StartTime;
ULONGLONG StartTime;
BOOL FilePause;

BOOL FileRetrySend, FileRetryEcho, FileCRSend, FileReadEOF, BinaryMode;
Expand Down Expand Up @@ -118,7 +118,7 @@ static BOOL OpenFTDlg(PFileVar fv)
free(DlgCaption);

fv->FilePause = FALSE;
fv->StartTime = GetTickCount();
fv->StartTime = GetTickCount64();
fv->SendDlg = FTDlg; /* File send */

return TRUE;
Expand Down
4 changes: 2 additions & 2 deletions teraterm/teraterm/filesys_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typedef struct {
LONG FileSize; // ? 菴ソ縺」縺ヲ縺�↑縺
LONG ByteCount; // 繝輔ぃ繧、繝ォ繧オ繧、繧コ

DWORD StartTime;
ULONGLONG StartTime;

enum enumLineEnd eLineEnd;

Expand Down Expand Up @@ -406,7 +406,7 @@ static BOOL LogStart(PFileVar fv, const wchar_t *fname)
}

fv->IsPause = FALSE;
fv->StartTime = GetTickCount();
fv->StartTime = GetTickCount64();

if (ts.DeferredLogWriteMode) {
StartThread(fv);
Expand Down
2 changes: 1 addition & 1 deletion teraterm/teraterm/filesys_proto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static PFileVarProto FileVar = NULL;
static PProtoDlg PtDlg = NULL;
static BOOL cv_ProtoFlag = FALSE;

static void _SetDlgTime(TFileVarProto *fv, DWORD elapsed, int bytes)
static void _SetDlgTime(TFileVarProto *fv, ULONGLONG elapsed, int bytes)
{
SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, elapsed, bytes);
}
Expand Down
2 changes: 1 addition & 1 deletion teraterm/teraterm/filesys_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ typedef TFileVarProto *PFileVarProto;
// UI縺ェ縺ゥ諠�ア陦ィ遉コ逕ィ髢「謨ー
typedef struct InfoOp_ {
void (*InitDlgProgress)(struct FileVarProto *fv, int *CurProgStat);
void (*SetDlgTime)(struct FileVarProto *fv, DWORD elapsed, int bytes);
void (*SetDlgTime)(struct FileVarProto *fv, ULONGLONG elapsed, int bytes);
void (*SetDlgPacketNum)(struct FileVarProto *fv, LONG Num);
void (*SetDlgByteCount)(struct FileVarProto *fv, LONG Num);
void (*SetDlgPercent)(struct FileVarProto *fv, LONG a, LONG b, int *p);
Expand Down
Loading
Loading