Tuesday, May 8, 2012

Ant: How to compare timestamps?

In a long running Ant script, I have a target that gets called roughly once per second. (This is probably not a good thing, but let's accept it for the moment.)

I only want it to execute if its last actual execution was at least five minutes ago.



One idea for a solution is to maintain a lastRunTimestamp property, and compare the current time to that.



Problem: How can I compare timestamps in Ant?



Another solution that would also be welcome is a means of executing the target only at specified time intervals, so that the check would not be necessary.



I am using Ant 1.7.1 and ant-contrib.



Any ideas are greatly appreciated - thanks!





No comments:

Post a Comment