Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
69 changes: 69 additions & 0 deletions doc/en/html/macro/command/uptime64.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>uptime64</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../../style.css" type="text/css">
</head>

<body>


<h1>uptime64</h1>

<p>
Gets System Up Time. <em>(version 5.7.0 or later)</em>
</p>

<pre class="macro-syntax">
int64 &lt;var&gt;
uptime64 &lt;var&gt;
</pre>

<h2>Remarks</h2>

<p>
Retrieves the number of milliseconds that have elapsed since the Windows OS was started,
and then stores the value into the &lt;int64var&gt; variable.
</p>

<p>
The time is valid after the system is run continuously for 49.7 days.
</p>


<h2>Example</h2>

<pre class="macro-example">
; How to get the uptime in Windows
int64 var
uptime64 var
day = var / 86400000
var = var % 86400000
hour = var / 3600000
var = var % 3600000
min = var / 60000
var = var % 60000
sec = var / 1000

sprintf2 str "System Up Time: %d Days, %d Hours, %d Minutes, %d Seconds" day hour min sec
messagebox str "uptime"
</pre>

<pre class="macro-example">
int64 varstart
int64 varend
uptime64 varstart

; do something...

uptime64 varend
diff = varend - varstart
sprintf2 str "MACRO running time: %d msec" diff
messagebox str "running time"
</pre>

</body>
</html>
5 changes: 5 additions & 0 deletions doc/en/teraterm.hhc
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,11 @@
<param name="Local" value="html\macro\command\uptime.html">
<param name="ImageNumber" value="11">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="uptime64">
<param name="Local" value="html\macro\command\uptime64.html">
<param name="ImageNumber" value="11">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="var2clipb">
<param name="Local" value="html\macro\command\var2clipb.html">
Expand Down
1 change: 1 addition & 0 deletions doc/en/teraterm.hhp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ HlpMacroCommandToupper=html\macro\command\toupper.html
HlpMacroCommandUnlink=html\macro\command\unlink.html
HlpMacroCommandUntil=html\macro\command\until.html
HlpMacroCommandUptime=html\macro\command\uptime.html
HlpMacroCommandUptime64=html\macro\command\uptime64.html
HlpMacroCommandVar2clipb=html\macro\command\var2clipb.html
HlpMacroCommandWait=html\macro\command\wait.html
HlpMacroCommandWait4all=html\macro\command\wait4all.html
Expand Down
68 changes: 68 additions & 0 deletions doc/ja/html/macro/command/uptime64.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>uptime64</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../../style.css" type="text/css">
</head>

<body>


<h1>uptime64</h1>

<p>
OSの稼働時間を取得する。<em>(バージョン5.7.0以降)</em>
</p>

<pre class="macro-syntax">
int64 &lt;var&gt;
uptime64 &lt;var&gt;
</pre>

<h2>解説</h2>

<p>
Windows OSの稼働時間(ミリ秒)を &lt;int64var&gt; に格納する。
</p>

<p>
※稼働時間が49日を経過しても有効
</p>


<h2>例</h2>

<pre class="macro-example">
; How to get the uptime in Windows
int64 var
uptime64 var
day = var / 86400000
var = var % 86400000
hour = var / 3600000
var = var % 3600000
min = var / 60000
var = var % 60000
sec = var / 1000

sprintf2 str "System Up Time: %d Days, %d Hours, %d Minutes, %d Seconds" day hour min sec
messagebox str "uptime"
</pre>

<pre class="macro-example">
int64 varstart
int64 varend
uptime64 varstart

; do something...

uptime64 varend
diff = varend - varstart
sprintf2 str "MACRO running time: %d msec" diff
messagebox str "running time"
</pre>

</body>
</html>
5 changes: 5 additions & 0 deletions doc/ja/teraterm.hhc
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,11 @@
<param name="Local" value="html\macro\command\uptime.html">
<param name="ImageNumber" value="11">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="uptime64">
<param name="Local" value="html\macro\command\uptime64.html">
<param name="ImageNumber" value="11">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="var2clipb">
<param name="Local" value="html\macro\command\var2clipb.html">
Expand Down
1 change: 1 addition & 0 deletions doc/ja/teraterm.hhp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ HlpMacroCommandToupper=html\macro\command\toupper.html
HlpMacroCommandUnlink=html\macro\command\unlink.html
HlpMacroCommandUntil=html\macro\command\until.html
HlpMacroCommandUptime=html\macro\command\uptime.html
HlpMacroCommandUptime64=html\macro\command\uptime64.html
HlpMacroCommandVar2clipb=html\macro\command\var2clipb.html
HlpMacroCommandWait=html\macro\command\wait.html
HlpMacroCommandWait4all=html\macro\command\wait4all.html
Expand Down
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
1 change: 1 addition & 0 deletions teraterm/common/helpid.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
#define HlpMacroCommandUnlink 92099
#define HlpMacroCommandUntil 92128
#define HlpMacroCommandUptime 92212
#define HlpMacroCommandUptime64 92213
#define HlpMacroCommandVar2clipb 92114
#define HlpMacroCommandWait 92100
#define HlpMacroCommandWait4all 92148
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
Loading
Loading