[Ttssh2-commit] [4921] gettime, getdate にタイムゾーンを指定できるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 5月 2日 (水) 16:35:33 JST


Revision: 4921
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4921
Author:   yutakapon
Date:     2012-05-02 16:35:33 +0900 (Wed, 02 May 2012)
Log Message:
-----------
gettime, getdate にタイムゾーンを指定できるようにした。
cf.
http://logmett.com/forum/viewtopic.php?f=6&t=1996

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/macro/command/getdate.html
    trunk/doc/en/html/macro/command/gettime.html
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/macro/command/getdate.html
    trunk/doc/ja/html/macro/command/gettime.html
    trunk/teraterm/ttpmacro/ttl.c

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/doc/en/html/about/history.html	2012-05-02 07:35:33 UTC (rev 4921)
@@ -68,6 +68,7 @@
           <li>added a sample code in the <a href="../macro/command/connect.html">connect</a> command.</li>
           <li>added the <a href="../macro/command/filelock.html">filelock</a> command.</li>
           <li>added the <a href="../macro/command/fileunlock.html">fileunlock</a> command.</li>
+          <li>added the third argument _timezone_ at the <a href="../macro/command/gettime.html">gettime</a> and <a href="../macro/command/getdate.html">getdate</a> command.</li>
         </ul></li>
       <li>added the LanguageUI entry on the <a href="..\menu\setup-general.html">General setup dialog</a>. Also, a user will be confirmed whether Tera Term is be relaunched.</li>
       <li>A message dialog is shown when the cygterm.cfg has been saved on the Cygwin tab of the <a href="../menu/setup-additional.html">Additional settings dialog</a>.</li>

Modified: trunk/doc/en/html/macro/command/getdate.html
===================================================================
--- trunk/doc/en/html/macro/command/getdate.html	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/doc/en/html/macro/command/getdate.html	2012-05-02 07:35:33 UTC (rev 4921)
@@ -18,7 +18,7 @@
 </p>
 
 <pre class="macro-syntax">
-getdate &lt;strvar&gt; [&lt;format&gt;]
+getdate &lt;strvar&gt; [&lt;format&gt;] [&lt;timezone&gt;]
 </pre>
 
 <h2>Remarks</h2>
@@ -29,8 +29,8 @@
 </p>
 
 <p>
-The behavior of the getdate command specified with the format equals the gettime command specified with the same format.
-</p>
+The behavior of the getdate command specified with the format equals the gettime command specified with the same format.<br>
+When the &lt;timezone&gt; argument is specified as a timezone string, the timestamp is generated by using the timezone.</p>
 
 <p>
 This command returns one of the following values in the system variable "result":
@@ -77,6 +77,11 @@
 ;Stores the current date with the user format to "logfile" variable. 
 ;The format is log-YYYYMMDD-HHMMSS.txt.
 getdate logfile "log-%Y%m%d-%H%M%S.txt"
+
+;To generate a GMT/UTC time stamp
+tz="GMT"
+gettime s "%Y/%m/%d %H:%M:%S" tz
+messagebox s tz
 </pre>
 
 <h2>See also</h2>

Modified: trunk/doc/en/html/macro/command/gettime.html
===================================================================
--- trunk/doc/en/html/macro/command/gettime.html	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/doc/en/html/macro/command/gettime.html	2012-05-02 07:35:33 UTC (rev 4921)
@@ -18,7 +18,7 @@
 </p>
 
 <pre class="macro-syntax">
-gettime &lt;strvar&gt; [&lt;format&gt;]
+gettime &lt;strvar&gt; [&lt;format&gt;] [&lt;timezone&gt;]
 </pre>
 
 <h2>Remarks</h2>
@@ -29,8 +29,8 @@
 </p>
 
 <p>
-The behavior of the gettime command specified with the format equals the getdate command specified with the same format.
-</p>
+The behavior of the gettime command specified with the format equals the getdate command specified with the same format.<br>
+When the &lt;timezone&gt; argument is specified as a timezone string, the timestamp is generated by using the timezone.</p>
 
 <p>
 This command returns one of the following values in the system variable "result":
@@ -81,6 +81,11 @@
 logopen logfile 0 0
 logwrite 'test data'
 logclose
+
+;To generate a GMT/UTC time stamp
+tz="GMT"
+gettime s "%Y/%m/%d %H:%M:%S" tz
+messagebox s tz
 </pre>
 
 <h2>See also</h2>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/doc/ja/html/about/history.html	2012-05-02 07:35:33 UTC (rev 4921)
@@ -68,6 +68,7 @@
           <li><a href="../macro/command/connect.html">connect</a>\x83R\x83}\x83\x93\x83h\x82Ƀp\x83\x89\x83\x81\x81[\x83^\x82𗘗p\x82\xB5\x82\xBD\x83T\x83\x93\x83v\x83\x8B\x83R\x81[\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
           <li><a href="../macro/command/filelock.html">filelock</a>\x83R\x83}\x83\x93\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
           <li><a href="../macro/command/fileunlock.html">fileunlock</a>\x83R\x83}\x83\x93\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
+          <li><a href="../macro/command/gettime.html">gettime</a>, <a href="../macro/command/getdate.html">getdate</a>\x83R\x83}\x83\x93\x83h\x82̑\xE63\x88\xF8\x90\x94\x82Ƀ^\x83C\x83\x80\x83]\x81[\x83\x93\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
         </ul></li>
       <li><a href="..\menu\setup-general.html">General setup\x83_\x83C\x83A\x83\x8D\x83O</a>\x82Ō\xBE\x8C\xEA\x83t\x83@\x83C\x83\x8B\x82\xF0\x8Ew\x92\xE8\x82ł\xAB\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B\x90ݒ\xE8\x95ύX\x8C\xE3\x81A\x8DċN\x93\xAE\x82\xB7\x82邩\x82\xF0\x96₢\x8D\x87\x82킹\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       <li><a href="../menu/setup-additional.html">Additional settings\x83_\x83C\x83A\x83\x8D\x83O</a>\x82\xCCCygwin\x83^\x83u\x82ŁA\x90ݒ\xE8\x95ۑ\xB6\x82ł\xAB\x82\xBD\x8Fꍇ\x81A\x83\x81\x83b\x83Z\x81[\x83W\x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>

Modified: trunk/doc/ja/html/macro/command/getdate.html
===================================================================
--- trunk/doc/ja/html/macro/command/getdate.html	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/doc/ja/html/macro/command/getdate.html	2012-05-02 07:35:33 UTC (rev 4921)
@@ -18,7 +18,7 @@
 </p>
 
 <pre class="macro-syntax">
-getdate &lt;strvar&gt; [&lt;format&gt;]
+getdate &lt;strvar&gt; [&lt;format&gt;] [&lt;timezone&gt;]
 </pre>
 
 <h2>\x89\xF0\x90\xE0</h2>
@@ -29,7 +29,8 @@
 </p>
 
 <p>
-format\x82\xAA\x8Ew\x92肳\x82ꂽgetdate\x82́A\x93\xAF\x82\xB6format\x82\xAA\x8Ew\x92肳\x82ꂽgettime\x82Ɠ\xAE\x8D삪\x93\x99\x82\xB5\x82\xAD\x82Ȃ\xE9\x81B
+format\x82\xAA\x8Ew\x92肳\x82ꂽgetdate\x82́A\x93\xAF\x82\xB6format\x82\xAA\x8Ew\x92肳\x82ꂽgettime\x82Ɠ\xAE\x8D삪\x93\x99\x82\xB5\x82\xAD\x82Ȃ\xE9\x81B<br>
+&lt;timezone&gt \x82Ƀ^\x83C\x83\x80\x83]\x81[\x83\x93\x82\xF0\x95\\x82\xB7\x95\xB6\x8E\x9A\x97\xF1\x82\xF0\x8Ew\x92肷\x82\xE9\x82ƁA\x83^\x83C\x83\x80\x83]\x81[\x83\x93\x82\xF0\x89\xC1\x96\xA1\x82\xB5\x82\xBD\x93\xFA\x95t\x8Cv\x8EZ\x82\xAA\x8Ds\x82\xED\x82\xEA\x82\xE9\x81B
 </p>
 
 <p>
@@ -79,6 +80,11 @@
 ;\x8C\xBB\x8D݂̓\xFA\x8E\x9E\x82\xF0\x8C\xB3\x82ɂ\xB5\x82ă\x8D\x83O\x83t\x83@\x83C\x83\x8B\x96\xBC\x82𐶐\xAC\x82\xB5\x81A\x95ϐ\x94logfile\x82Ɋi\x94[\x81B
 ;\x8C`\x8E\xAE\x82\xCDlog-YYYYMMDD-HHMMSS.txt
 getdate logfile "log-%Y%m%d-%H%M%S.txt"
+
+;GMT\x82Ŏ\x9E\x8D\x8F\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+tz="GMT"
+gettime s "%Y/%m/%d %H:%M:%S" tz
+messagebox s tz
 </pre>
 
 <h2>\x8EQ\x8F\xC6</h2>

Modified: trunk/doc/ja/html/macro/command/gettime.html
===================================================================
--- trunk/doc/ja/html/macro/command/gettime.html	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/doc/ja/html/macro/command/gettime.html	2012-05-02 07:35:33 UTC (rev 4921)
@@ -18,7 +18,7 @@
 </p>
 
 <pre class="macro-syntax">
-gettime &lt;strvar&gt; [&lt;format&gt;]
+gettime &lt;strvar&gt; [&lt;format&gt;] [&lt;timezone&gt;]
 </pre>
 
 <h2>\x89\xF0\x90\xE0</h2>
@@ -29,7 +29,8 @@
 </p>
 
 <p>
-format\x82\xAA\x8Ew\x92肳\x82ꂽgettime\x82́A\x93\xAF\x82\xB6format\x82\xAA\x8Ew\x92肳\x82ꂽgetdate\x82Ɠ\xAE\x8D삪\x93\x99\x82\xB5\x82\xAD\x82Ȃ\xE9\x81B
+format\x82\xAA\x8Ew\x92肳\x82ꂽgettime\x82́A\x93\xAF\x82\xB6format\x82\xAA\x8Ew\x92肳\x82ꂽgetdate\x82Ɠ\xAE\x8D삪\x93\x99\x82\xB5\x82\xAD\x82Ȃ\xE9\x81B<br>
+&lt;timezone&gt; \x82Ƀ^\x83C\x83\x80\x83]\x81[\x83\x93\x82\xF0\x95\\x82\xB7\x95\xB6\x8E\x9A\x97\xF1\x82\xF0\x8Ew\x92肷\x82\xE9\x82ƁA\x83^\x83C\x83\x80\x83]\x81[\x83\x93\x82\xF0\x89\xC1\x96\xA1\x82\xB5\x82\xBD\x93\xFA\x95t\x8Cv\x8EZ\x82\xAA\x8Ds\x82\xED\x82\xEA\x82\xE9\x81B
 </p>
 
 <p>
@@ -83,6 +84,11 @@
 logopen logfile 0 0
 logwrite 'test data'
 logclose
+
+;GMT\x82Ŏ\x9E\x8D\x8F\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+tz="GMT"
+gettime s "%Y/%m/%d %H:%M:%S" tz
+messagebox s tz
 </pre>
 
 <h2>\x8EQ\x8F\xC6</h2>

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2012-05-01 11:20:15 UTC (rev 4920)
+++ trunk/teraterm/ttpmacro/ttl.c	2012-05-02 07:35:33 UTC (rev 4921)
@@ -2168,7 +2168,7 @@
 {
 	WORD Err;
 	TVarId VarId;
-	TStrVal Str1, Str2;
+	TStrVal Str1, Str2, tzStr;
 	time_t time1;
 	struct tm *ptm;
 	char *format;
@@ -2187,6 +2187,15 @@
 //			return ErrSyntax;
 		}
 		set_result = TRUE;
+
+		// \x83^\x83C\x83\x80\x83]\x81[\x83\x93\x82̎w\x92肪\x82\xA0\x82\xEA\x82΁Alocaltime()\x82ɉe\x8B\xBF\x82\xB3\x82\xB9\x82\xE9\x81B(2012.5.2 yutaka)
+		if (CheckParameterGiven()) {
+			GetStrVal(tzStr, &Err);
+			if (Err!=0) return Err;
+			_putenv_s("TZ", tzStr);
+			_tzset();
+		}
+
 	}
 	else {
 		switch (mode) {



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