You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dennis <co...@alum.rpi.edu> on 2003/05/13 21:52:59 UTC

RE: Date

Hi All,

In regards to the current date thread that is going on in the list.  I was
wondering if anyone had answered this question posted approx. a year ago about
getting the duration of a task.

At the very least is there anyway to define a <tstamp> property with the proper
formatting and just touch it to get the current time?

E.g. I'd like to be able to do something like this:
<target name="compile" depends="init">
   <tstamp>
     <format property="timestamp" pattern="MM/dd/yy HH:mm:ss" />
   </tstamp>

   <echo>${timestamp}: Compiling Java sources using JDK ${ant.java.version}</echo>
   <javac	destdir="${build.home}"
		srcdir="${src.home}"
  />
  <echo>${timestamp}: Finished compile.</echo>
</target>

Where ${timestamp} would be the time that the echo is being done.  I know that I
could have multiple <tstamp> definitions to accomplish this, but seems very messy.

The original email follows below, Thanks in advance for any suggestions,
Dennis


---------------------------------------------------------
List:     ant-user
Subject:  Execution Duration of a Task
From:     "Juergen Damke" <DAMKE () de ! ibm ! com>
Date:     2002-04-11 8:19:06
[Download message RAW]


Is there a possibillity to echo the duration of certain tasks in a log.=


The idea is to do a <tstamp/> at start and a <tstamp/> at the end and
calulation
the time difference in mins & seconds.

Mit freundlichen Gr=FC=DFen / With best regards
J=FCrgen Damke
______________________________________________________________________
IBM WebSphere Portal Server Development 1, Dept 6547
URL: http://www-4.ibm.com/software/webservers/portal/
IBM Development Laboratory B=F6blingen, Germany
Phone: +49/7031/16 -3375, Fax: -4888  -  MailTo:damke@de.ibm.com=

Re: Date

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Look at the 'prefix' attribute on <tstamp> to set two different 
properties with times (prefix="before" / prefix="after", for example).

	Erik


On Tuesday, May 13, 2003, at 03:52  PM, Dennis wrote:

> Hi All,
>
> In regards to the current date thread that is going on in the list.  I 
> was
> wondering if anyone had answered this question posted approx. a year 
> ago about
> getting the duration of a task.
>
> At the very least is there anyway to define a <tstamp> property with 
> the proper
> formatting and just touch it to get the current time?
>
> E.g. I'd like to be able to do something like this:
> <target name="compile" depends="init">
>    <tstamp>
>      <format property="timestamp" pattern="MM/dd/yy HH:mm:ss" />
>    </tstamp>
>
>    <echo>${timestamp}: Compiling Java sources using JDK 
> ${ant.java.version}</echo>
>    <javac	destdir="${build.home}"
> 		srcdir="${src.home}"
>   />
>   <echo>${timestamp}: Finished compile.</echo>
> </target>
>
> Where ${timestamp} would be the time that the echo is being done.  I 
> know that I
> could have multiple <tstamp> definitions to accomplish this, but seems 
> very messy.
>
> The original email follows below, Thanks in advance for any 
> suggestions,
> Dennis
>
>
> ---------------------------------------------------------
> List:     ant-user
> Subject:  Execution Duration of a Task
> From:     "Juergen Damke" <DAMKE () de ! ibm ! com>
> Date:     2002-04-11 8:19:06
> [Download message RAW]
>
>
> Is there a possibillity to echo the duration of certain tasks in a 
> log.=
>
>
> The idea is to do a <tstamp/> at start and a <tstamp/> at the end and
> calulation
> the time difference in mins & seconds.
>
> Mit freundlichen Gr=FC=DFen / With best regards
> J=FCrgen Damke
> ______________________________________________________________________
> IBM WebSphere Portal Server Development 1, Dept 6547
> URL: http://www-4.ibm.com/software/webservers/portal/
> IBM Development Laboratory B=F6blingen, Germany
> Phone: +49/7031/16 -3375, Fax: -4888  -  MailTo:damke@de.ibm.com=
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>