使用 Ant 获取时间戳差异 [英] Get timestamp difference using Ant
本文介绍了使用 Ant 获取时间戳差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用 Ant 计算时差.
基本上它有2个变量.一个分配了当前时间,另一个分配了不同的时间.我需要使用 Ant 来获取时差.像下面这样的东西.如果有人有代码请回复.
I need to calculate time difference using Ant.
Basically it has 2 variables. One is assigned the current time, and the other one has a different time. I need to get the time difference using Ant. Something like below. If anyone have code please reply.
variable a = current time;
variable b = different time
echo (a - b) ;
推荐答案
这里有一个更简单的解决方案:
Here is a much simpler solution:
<script language="javascript">
project.setProperty('startTime', new Date().getTime());
</script>
...
<script language="javascript">
project.setProperty('elapsedTime', new Date().getTime() - startTime)
</script>
<echo>Elapsed time: ${elapsedTime} ms</echo>
这篇关于使用 Ant 获取时间戳差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文