Timer: Difference between revisions

Jump to navigation Jump to search
680 bytes added ,  4 April 2018
+dos
(+dos)
Line 10: Line 10:
SELECT @timer := CURRENT_TIMESTAMP();
SELECT @timer := CURRENT_TIMESTAMP();
SELECT SLEEP(2); /* sleep 2 seconds for testing purpose */
SELECT SLEEP(2); /* sleep 2 seconds for testing purpose */
SELECT 'custom message' AS 'action', CURRENT_TIMESTAMP() AS 'end time', @timer AS 'start time', TIMEDIFF(CURRENT_TIMESTAMP(), @timer) AS 'time elapsed';
SELECT 'custom message' AS 'action', CURRENT_TIMESTAMP() AS 'finish time', @timer AS 'start time', TIMEDIFF(CURRENT_TIMESTAMP(), @timer) AS 'time elapsed';
</pre>
</pre>


Line 29: Line 29:
# expected result:  
# expected result:  
#  Elapsed time 00h:00m:02s
#  Elapsed time 00h:00m:02s
</pre>
== Windows command (DOS) ==
<pre>
# show the start time
prompt $d $t $_$P$G
# do something
# show the finish time
prompt $d $t $_$P$G
</pre>
or ...<ref>[https://stackoverflow.com/questions/673523/how-do-i-measure-execution-time-of-a-command-on-the-windows-command-line batch file - How do I measure execution time of a command on the Windows command line? - Stack Overflow]</ref><ref>[https://stackoverflow.com/questions/166044/sleeping-in-a-batch-file python - Sleeping in a batch file - Stack Overflow]</ref>
<pre>
# recode the start time
set startTime=%time%
# do something
# show the start and finish time
echo Start Time: %startTime%
echo Finish Time: %time%
</pre>
</pre>


Navigation menu