之前做PIC粒子模拟时程序通常跑好几天,为了对比不同网格、粒子数等条件下的运行天数,我养成了一个在程序运行程序开始和程序运行结束分别打印当前时间戳的习惯,并坚持了3个多月。下面结合自己的实践经历,分别使用不同编程语言打印当前时间戳。
Python: import datetime;print("Run by CYJ,",datetime.datetime.now())
MATLAB: "Run by CYJ,"+datestr(now())
Java: System.out.println("Run by CYJ,"+(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
VB:Debug.Print "Run by CYJ, " & Now()
PHP: <?php echo "Run by CYJ," . date('Y-m-d h:i:s', time());
JavaScript: console.log("Run by CYJ,"+(new Date().toLocaleString( )));
C: system("date");printf("Run by CYJ");
C++: string time =getTime();cout << "Run by CYJ," << time << endl;
Mysql: select "Run by CYJ,",now();
HTML: <div id="show_time0"><script>setInterval("show_time0.innerHTML='Run by CYJ, '+new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);</script></div>
Linux: echo Run by CYJ, && date