[Ttssh2-commit] [4551] ミリ秒を含む現在時刻を返す処理を関数化

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 7月 29日 (金) 01:16:39 JST


Revision: 4551
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4551
Author:   maya
Date:     2011-07-29 01:16:39 +0900 (Fri, 29 Jul 2011)

Log Message:
-----------
ミリ秒を含む現在時刻を返す処理を関数化

Modified Paths:
--------------
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/teraterm/filesys.cpp
    trunk/teraterm/ttpcmn/ttpcmn.def
    trunk/ttssh2/ttxssh/ttxssh.c


-------------- next part --------------
Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2011-07-28 16:15:05 UTC (rev 4550)
+++ trunk/teraterm/common/ttlib.c	2011-07-28 16:16:39 UTC (rev 4551)
@@ -862,3 +862,26 @@
 	kcode--;
 	return Table[lang][kcode];
 }
+
+char *mctimelocal()
+{
+	SYSTEMTIME LocalTime;
+	static char strtime[29];
+	char week[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+	char month[][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+	                   "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+
+	GetLocalTime(&LocalTime);
+	_snprintf_s(strtime, sizeof(strtime), _TRUNCATE,
+	            "%s %s %02d %02d:%02d:%02d.%03d %04d",
+	            week[LocalTime.wDayOfWeek],
+	            month[LocalTime.wMonth-1],
+	            LocalTime.wDay,
+	            LocalTime.wHour,
+	            LocalTime.wMinute,
+	            LocalTime.wSecond,
+	            LocalTime.wMilliseconds,
+	            LocalTime.wYear);
+
+	return strtime;
+}
\ No newline at end of file

Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2011-07-28 16:15:05 UTC (rev 4550)
+++ trunk/teraterm/common/ttlib.h	2011-07-28 16:16:39 UTC (rev 4551)
@@ -46,6 +46,7 @@
 int KanjiCode2List(int lang, int kcode);
 int List2KanjiCode(int lang, int kcode);
 int KanjiCodeTranslate(int lang, int kcode);
+char *mctimelocal();
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/teraterm/filesys.cpp
===================================================================
--- trunk/teraterm/teraterm/filesys.cpp	2011-07-28 16:15:05 UTC (rev 4550)
+++ trunk/teraterm/teraterm/filesys.cpp	2011-07-28 16:16:39 UTC (rev 4551)
@@ -667,6 +667,7 @@
 			// Žž‚ð‘‚«o‚·(2006.7.23 maya)
 			// “ú•tƒtƒH[ƒ}ƒbƒg‚ð“ú–{‚Å‚Í‚È‚­¢ŠE•W€‚ɕύX‚µ‚½ (2006.7.23 yutaka)
 			/* 2007.05.24 Gentaro */
+			// ƒ~ƒŠ•b‚à•\Ž¦‚·‚é‚悤‚ɕύX (2009.5.23 maya)
 			if ( ts.LogTimestamp && eLineEnd ) {
 #if 1
 #if 0
@@ -680,23 +681,7 @@
 						LocalTime.wHour, LocalTime.wMinute, LocalTime.wSecond,
 						LocalTime.wMilliseconds);
 #else
-				// ƒ~ƒŠ•b‚à•\Ž¦‚·‚é‚悤‚ɕύX (2009.5.23 maya)
-				SYSTEMTIME LocalTime;
-				GetLocalTime(&LocalTime);
-				char strtime[29];
-				char week[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-				char month[][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-				                   "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-				_snprintf_s(strtime, sizeof(strtime), _TRUNCATE,
-				            "%s %s %02d %02d:%02d:%02d.%03d %04d",
-				            week[LocalTime.wDayOfWeek],
-				            month[LocalTime.wMonth-1],
-				            LocalTime.wDay,
-				            LocalTime.wHour,
-				            LocalTime.wMinute,
-				            LocalTime.wSecond,
-				            LocalTime.wMilliseconds,
-				            LocalTime.wYear);
+				char *strtime = mctimelocal();
 #endif
 #else
 					time_t tick = time(NULL);

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2011-07-28 16:15:05 UTC (rev 4550)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2011-07-28 16:16:39 UTC (rev 4551)
@@ -43,3 +43,5 @@
   
   is_NT4 @50
   doSelectFolder @51
+
+  mctimelocal @53

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2011-07-28 16:15:05 UTC (rev 4550)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2011-07-28 16:16:39 UTC (rev 4551)
@@ -892,25 +892,10 @@
 		             _S_IREAD | _S_IWRITE);
 
 		if (file >= 0) {
-			SYSTEMTIME LocalTime;
-			char strtime[29];
-			char week[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-			char month[][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-			                   "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+			char *strtime = mctimelocal();
 			DWORD processid;
 			char tmp[26];
 
-			GetLocalTime(&LocalTime);
-			_snprintf_s(strtime, sizeof(strtime), _TRUNCATE,
-			            "%s %s %02d %02d:%02d:%02d.%03d %04d",
-			            week[LocalTime.wDayOfWeek],
-			            month[LocalTime.wMonth-1],
-			            LocalTime.wDay,
-			            LocalTime.wHour,
-			            LocalTime.wMinute,
-			            LocalTime.wSecond,
-			            LocalTime.wMilliseconds,
-			            LocalTime.wYear);
 			_write(file, strtime, strlen(strtime));
 			GetWindowThreadProcessId(pvar->cv->HWin, &processid);
 			_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, " [%lu] ",processid);



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