Thanks Evan, here's what worked for me to get the span of time:
 
<property name="build.starttime" value="${datetime::now()}"/>

    ...do some stuff that takes time

<property name="build.endtime" value="${datetime::now()}"/>
 
<echo message="Seconds to perform build: ${timespan::get-seconds(timespan::from-ticks(datetime::get-ticks(build.endtime) - datetime::get-ticks(build.starttime)))}" />
 
~Robert
 


On Mar 31, 2005 11:50 AM, Evan Levy <[EMAIL PROTECTED]> wrote:
This is wordy, but *should* work (i.e.  I haven't tested):

timespan::get-seconds(timespan::from-ticks(datetime::get-ticks(datetime:
:now()) - datetime::get-ticks(SomePropertyHoldingTheStartingDatetime)))

... would give you the number of seconds between now and then.  For
other time types, substitute timespan::get-seconds for
timespan::get-minutes, timespan::get-hours, etc.

E

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Robert
Smith
Sent: March 31, 2005 12:35 PM
To: [email protected]
Subject: [Nant-users] Calculating a span of time

I haven't found a way to determine the amount of time between a start
and stop time...for instance:

<property name="build.starttime" value="${datetime::now()}"/>
    ...do some stuff that takes time
<property name="build.endtime" value="${datetime::now()}"/>

I want to know how long between the two time periods in minutes and
seconds...

I tried to play with the timespan functions, but haven't found a way to
successfully convert the property resulting from datetime::now into an
Int...or I'm not using them correctly.

I imagine there are a couple ways to accomplish this, but hoping for
some assistance.

Thanks,

Robert

-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/Info/Sentarus/hamr30
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users



--
Robert Smith, W7RAS
Hillsboro CERT
www.hillsborocert.org
[EMAIL PROTECTED]
(971) 219-4605

Reply via email to