[Ttssh2-commit] [6768] ログのタイムスタンプにUTCを使用できるようにした

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 6月 4日 (日) 22:06:22 JST


Revision: 6768
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6768
Author:   maya
Date:     2017-06-04 22:06:21 +0900 (Sun, 04 Jun 2017)
Log Message:
-----------
ログのタイムスタンプにUTCを使用できるようにした

https://osdn.net/ticket/browse.php?group_id=1412&tid=36971

Modified Paths:
--------------
    trunk/installer/release/TERATERM.INI
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/filesys.cpp
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/installer/release/TERATERM.INI
===================================================================
--- trunk/installer/release/TERATERM.INI	2017-06-04 12:54:47 UTC (rev 6767)
+++ trunk/installer/release/TERATERM.INI	2017-06-04 13:06:21 UTC (rev 6768)
@@ -543,6 +543,9 @@
 ;   %Y/%m/%d %H:%M:%S.%N    ... 2017/06/04 21:12:40.123
 LogTimestampFormat=%a %b %e %H:%M:%S.%N %Y
 
+; Use UTC/GMT time for Log each line timestamp
+LogTimestampUTC=off
+
 ; Exclusive lock for log file
 LogLockExclusive=on
 

Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2017-06-04 12:54:47 UTC (rev 6767)
+++ trunk/teraterm/common/ttlib.c	2017-06-04 13:06:21 UTC (rev 6768)
@@ -1460,7 +1460,7 @@
 	return Table[lang][kcode];
 }
 
-char *mctimelocal(char *format)
+char *mctimelocal(char *format, BOOL utc_flag)
 {
 	SYSTEMTIME systime;
 	static char strtime[29];
@@ -1470,7 +1470,12 @@
 	char tmp[5];
 	unsigned int i = strlen(format);
 
-	GetLocalTime(&systime);
+	if (utc_flag) {
+		GetSystemTime(&systime);
+	}
+	else {
+		GetLocalTime(&systime);
+	}
 	memset(strtime, 0, sizeof(strtime));
 	for (i=0; i<strlen(format); i++) {
 		if (format[i] == '%') {

Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2017-06-04 12:54:47 UTC (rev 6767)
+++ trunk/teraterm/common/ttlib.h	2017-06-04 13:06:21 UTC (rev 6768)
@@ -63,7 +63,7 @@
 int KanjiCode2List(int lang, int kcode);
 int List2KanjiCode(int lang, int kcode);
 int KanjiCodeTranslate(int lang, int kcode);
-char *mctimelocal(char *format);
+char *mctimelocal(char *format, BOOL utc_flag);
 
 void b64encode(PCHAR dst, int dsize, PCHAR src, int len);
 int b64decode(PCHAR dst, int dsize, PCHAR src);

Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2017-06-04 12:54:47 UTC (rev 6767)
+++ trunk/teraterm/common/tttypes.h	2017-06-04 13:06:21 UTC (rev 6768)
@@ -540,7 +540,7 @@
 	WORD MaximizedBugTweak;
 	WORD NotifyClipboardAccess;
 	WORD SaveVTWinPos;
-	WORD Dummy3;		// \x8B\x8CDisablePasteMouseMButton. PasteFlag\x82ɓ\x9D\x8D\x87\x82\xB5\x82\xBD\x82\xBD\x82ߔp\x8E~\x81B\x91\xBC\x82֓]\x97p
+	WORD LogTimestampUTC;
 	int MouseWheelScrollLine;
 	WORD CRSend_ini;
 	WORD LocalEcho_ini;
@@ -1084,6 +1084,7 @@
  *
  * - At version 4.96, ttset_memfilemap was replaced with ttset_memfilemap_32.
  *   added tttset.LogTimestampFormat
+ *   added tttset.LogTimestampUTC
  *
  * - At version 4.95, ttset_memfilemap was replaced with ttset_memfilemap_31.
  *   added tttset.NotifyClipboardAccess

Modified: trunk/teraterm/teraterm/filesys.cpp
===================================================================
--- trunk/teraterm/teraterm/filesys.cpp	2017-06-04 12:54:47 UTC (rev 6767)
+++ trunk/teraterm/teraterm/filesys.cpp	2017-06-04 13:06:21 UTC (rev 6768)
@@ -957,7 +957,7 @@
 			{
 				tmp[0] = 0;
 				if ( ts.LogTimestamp && eLineEnd ) {
-					char *strtime = mctimelocal(ts.LogTimestampFormat);
+					char *strtime = mctimelocal(ts.LogTimestampFormat, ts.LogTimestampUTC);
 					/* 2007.05.24 Gentaro */
 					if( eLineEnd == Line_FileHead ){
 						strncat_s(tmp, sizeof(tmp), "\r\n", _TRUNCATE);
@@ -1012,7 +1012,7 @@
 							LocalTime.wHour, LocalTime.wMinute, LocalTime.wSecond,
 							LocalTime.wMilliseconds);
 	#else
-					char *strtime = mctimelocal(ts.LogTimestampFormat);
+					char *strtime = mctimelocal(ts.LogTimestampFormat, ts.LogTimestampUTC);
 	#endif
 	#else
 						time_t tick = time(NULL);

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2017-06-04 12:54:47 UTC (rev 6767)
+++ trunk/teraterm/ttpset/ttset.c	2017-06-04 13:06:21 UTC (rev 6768)
@@ -1057,6 +1057,9 @@
 	                        ts->LogTimestampFormat, sizeof(ts->LogTimestampFormat),
 	                        FName);
 
+	/* Use UTC/GMT time for Log each line timestamp */
+	ts->LogTimestampUTC = GetOnOff(Section, "LogTimestampUTC", FName, FALSE);
+
 	/* File Transfer dialog visibility */
 	ts->FTHideDialog = GetOnOff(Section, "FTHideDialog", FName, FALSE);
 
@@ -2540,6 +2543,9 @@
 	WritePrivateProfileString(Section, "LogTimestampFormat",
 	                          ts->LogTimestampFormat, FName);
 
+	/* Use UTC/GMT time for Log each line timestamp */
+	WriteOnOff(Section, "LogTimestampUTC", FName, ts->LogTimestampUTC);
+
 	/* Default Log file name (2006.8.28 maya) */
 	WritePrivateProfileString(Section, "LogDefaultName",
 	                          ts->LogDefaultName, FName);



Ttssh2-commit メーリングリストの案内
Back to archive index