[Zope] Differents of two ZopeTime

Small Business Services toolkit at magma.ca
Tue Mar 23 07:28:18 EST 2004


From: <fowlertrainer at anonym.hu>
>   I want to measure the time of process in Zope.
> 
>   sd=context.ZopeTime()
>   ...
>   se=context.ZopeTime()
>   d=se-sd
>   print str(DateTime(str(sd))
>   print str(DateTime(str(se))
> 
>   it is working, so it is show the two datetimes.
> 
>   But how to I show the different of the times ?
>   print str(DateTime(str(d)) is not working good !

Try (untested):

sd=context.ZopeTime()
se=context.ZopeTime()
diff=context.ZopeTime(se-sd)
print "diff=",diff.strftime('%X')

This should give you a time difference in format: HH:MM:SS

HTH

Jonathan






More information about the Zope mailing list