Skip to content
Merged
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
9 changes: 9 additions & 0 deletions doc/en/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ <h3 id="teraterm_5.7.0">YYYY.MM.DD (Ver 5.7.0 not released yet)</h3>
Previously, since short filename,SFN (DOS filename, 8.3 format) is used,
"ttxtest.dll-" was treated as "TTXTEST.DLL" and loaded.
</li>
<li>
Changed DPI awareness setting to process-wide instead of GUI thread only.
(<a href="https://github.com/TeraTermProject/teraterm/issues/1314" target="_blank">issue #1314</a>)
</li>
<li>
When <a href="../menu/setup-additional-terminal.html#TerminalID">Terminal ID</a> is "dumb",
Output timestamps to both the VT window and log file when logging.
(<a href="https://github.com/TeraTermProject/teraterm/issues/255" target="_blank">issue #255</a>)
</li>
</ul>
</li>

Expand Down
6 changes: 5 additions & 1 deletion doc/en/html/menu/setup-additional-log.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ <h1><a href="setup-additional.html">Additional settings</a> / "Log" Tab ([Setup]

<dt id="LogTimestamp">Timestamp</dt>
<dd>
If you select this option, a timestamp is added on top of each log line. The timestamp is added when the first character of the line appears.<br>
If you select this option, timestamp is output when first character of the line appears.<br>
When <a href="setup-additional-terminal.html#TerminalID">Terminal ID</a> is dumb,
timestamp is output to both VTWin and log file.<br>
When it is other than dumb, the timestamp is output to log file.<br>
<br>
The timestamp type can be selected from following.
<dl id="LogTimestampType">
<dt>Local Time</dt>
Expand Down
3 changes: 2 additions & 1 deletion doc/en/html/menu/setup-additional-terminal.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ <h1><a href="setup-additional.html">Additional settings</a> / "Terminal" tab ([S
</dd>
<dt>dumb</dt>
<dd>
Emulates <a href="../about/glossary.html#dumb">dumb terminal</a>.
Emulates <a href="../about/glossary.html#dumb">dumb terminal</a>.<br>
log <a href="setup-additional-log.html#LogTimestamp">Timestamp</a> is output to VT window and log file.
</dd>
</dl>

Expand Down
9 changes: 9 additions & 0 deletions doc/ja/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ <h3 id="teraterm_5.7.0">YYYY.MM.DD (Ver 5.7.0 not released yet)</h3>
�]���̓V���[�g�t�@�C����,SFN(DOS�t�@�C����,8.3�`��)�ň����Ă������߁A
"ttxtest.dll-" �� "TTXTEST.DLL" �Ƃ��Ĉ����A���[�h����Ă����B
</li>
<li>
��DPI�ݒ��GUI�X���b�h�݂̂ł͂Ȃ��A�v���Z�X�S�̂ōs���悤�ɂ����B
(<a href="https://github.com/TeraTermProject/teraterm/issues/1314" target="_blank">issue #1314</a>)
</li>
<li>
<a href="../menu/setup-additional-terminal.html#TerminalID">Terminal ID</a> �� "dumb" �̎��A
���O�擾���̃^�C���X�^���v��VT Window�ƃ��O�t�@�C���֏o�͂���悤�ɂ����B
(<a href="https://github.com/TeraTermProject/teraterm/issues/255" target="_blank">issue #255</a>)
</li>
</ul>
</li>

Expand Down
6 changes: 5 additions & 1 deletion doc/ja/html/menu/setup-additional-log.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@

<dt id="LogTimestamp">Timestamp</dt>
<dd>
���O�̍s���Ɏ�����lj��������ꍇ�͑I�����Ă��������B�s�̍ŏ��̕������o�͂��ꂽ�������lj�����܂��B<br>
�I�����A�s�̍ŏ��̕������o�͂��ꂽ���ɁA�������o�͂���܂��B<br>
<a href="setup-additional-terminal.html#TerminalID">Terminal ID</a>��dumb�̎��A
������VTWin�ƃ��O�t�@�C���ɏo�͂���܂��B<br>
dumb�ȊO�̎��A�����̓��O�t�@�C���ɏo�͂���܂��B<br>
<br>
�^�C���X�^���v�̎�ʂƂ��Ĉȉ����I���ł��܂��B
<dl id="LogTimestampType">
<dt>Local Time</dt>
Expand Down
3 changes: 2 additions & 1 deletion doc/ja/html/menu/setup-additional-terminal.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
</dd>
<dt>dumb</dt>
<dd>
<a href="../about/glossary.html#dumb">�_���[��</a>���G�~�����[�g���܂��B
<a href="../about/glossary.html#dumb">�_���[��</a>���G�~�����[�g���܂��B<br>
���O��<a href="setup-additional-log.html#LogTimestamp">Timestamp</a>��VT window�ɏo�͂���܂�
</dd>
</dl>

Expand Down
132 changes: 13 additions & 119 deletions teraterm/common/ttlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,110 +844,22 @@ DWORD get_OPENFILENAME_SIZEW()
return CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName);
}

/*
/**
* 現在の時間を文字列にして返す
*
* @param format strftime likeなフォーマット
* @param utc_flag TRUE / FALSE = UTCで出力 / ローカルタイムで出力
* @return 経過時刻文字列
* 不要になったらfree()すること
*/
char *mctimelocal(const char *format, BOOL utc_flag)
{
SYSTEMTIME systime;
const size_t sizeof_strtime = 29;
char *strtime = malloc(sizeof_strtime);
static const char week[][4] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static const char month[][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
char tmp[5];
unsigned int i = strlen(format);

*strtime = '\0';
if (utc_flag) {
GetSystemTime(&systime);
}
else {
GetLocalTime(&systime);
}
for (i=0; i<strlen(format); i++) {
if (format[i] == '%') {
char c = format[i + 1];
switch (c) {
case 'a':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%s", week[systime.wDayOfWeek]);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'b':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%s", month[systime.wMonth - 1]);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'd':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%02d", systime.wDay);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'e':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%2d", systime.wDay);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'H':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%02d", systime.wHour);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'N':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%03d", systime.wMilliseconds);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'm':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%02d", systime.wMonth);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'M':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%02d", systime.wMinute);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'S':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%02d", systime.wSecond);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'w':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%d", systime.wDayOfWeek);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case 'Y':
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%04d", systime.wYear);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
i++;
break;
case '%':
strncat_s(strtime, sizeof_strtime, "%", _TRUNCATE);
i++;
break;
default:
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%c", format[i]);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
break;
}
}
else {
_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%c", format[i]);
strncat_s(strtime, sizeof_strtime, tmp, _TRUNCATE);
}
}

return strtime;
wchar_t *formatW = ToWcharA(format);
wchar_t *strW = ttstrftime(formatW, utc_flag);
free(formatW);
char *strA = ToCharW(strW);
free(strW);
return strA;
}

/*
Expand All @@ -958,28 +870,10 @@ char *mctimelocal(const char *format, BOOL utc_flag)
*/
char *strelapsed(DWORD start_time)
{
size_t sizeof_strtime = 20;
char *strtime = malloc(sizeof_strtime);
int days, hours, minutes, seconds, msecs;
DWORD delta = GetTickCount() - start_time;

msecs = delta % 1000;
delta /= 1000;

seconds = delta % 60;
delta /= 60;

minutes = delta % 60;
delta /= 60;

hours = delta % 24;
days = delta / 24;

_snprintf_s(strtime, sizeof_strtime, _TRUNCATE,
"%d %02d:%02d:%02d.%03d",
days, hours, minutes, seconds, msecs);

return strtime;
wchar_t *strW = strelapsedW(start_time);
char *strA = ToCharW(strW);
free(strW);
return strA;
}

wchar_t * PASCAL GetParam(wchar_t *buff, size_t size, wchar_t *param)
Expand Down
2 changes: 2 additions & 0 deletions teraterm/common/ttlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ DllExport BOOL HasMultiMonitorSupport();
DllExport BOOL HasDnsQuery();
DllExport BOOL HasBalloonTipSupport();
DllExport char *mctimelocal(const char *format, BOOL utc_flag);
wchar_t *ttstrftime(const wchar_t *format, BOOL utc_flag);
char *strelapsed(DWORD start_time);
wchar_t *strelapsedW(DWORD start_time);

void b64encode(PCHAR dst, int dsize, PCHAR src, int len);
DllExport int b64decode(PCHAR dst, int dsize, PCHAR src);
Expand Down
Loading