Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7902881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:37:10+00:00 2026-06-03T09:37:10+00:00

In a long running Ant script, I have a target that gets called roughly

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:37:11+00:00Added an answer on June 3, 2026 at 9:37 am

    Interesting question, and one which is a bit harder to answer than I originally thought.

    You can use the <tstamp> task to set a time stamp that’s five minutes old:

    <tstamp>
      <format property="time_stamp"
          offset="-5"
          unit="minutes"
          pattern="MM/dd/yyyy hh:mm:ss aa"/>
    </tstamp>
    

    Once you have that timestamp, you can use the lastmodified condition of the <condition> task to see if a particular file has been updated since. If you don’t have a file, you can use the <touch> task to create one.

    <condition property="has.been.modified">
         <islastmodified dateTime="${time_stamp}" mode="after">
            <file file="${touch.file}"/>
         </islastmodified>
    </condition>
    

    The only issue is that default properties are immutable. Once set, you can’t change them. Fortunately you’re using ant-contrib and ant-contrib allows you to change that via the variable task.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have long running task that gets called using jquery ajax. i am using
I'm have a long-running perl script that outputs the percentage complete. How do I
I have a long-running script that seems to occasionally report the following NOTICE-level error:
We have a long-running msbuild script that I'm trying to speed up. Is there
I have a long running PHP process, that sometimes hangs in a loop. This
I have a long running process called ImportProductInformation called by a consoleapp that I'm
I have a long running (4-10 second) MVC action that runs a report from
I have a long running query that returns a large data set. This query
I have a long running redgate script that is applying a bunch of schema
I occasionally have some long running AJAX requests in my Wicket application. When this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.