:-) Thanks for optimizing the stuff!
> -----Original Message-----
> From: Bian Tan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 13, 2001 12:39 AM
> To: 'Chad Stansbury'
> Cc: avalon-dev@jakarta.apache.org
> Subject: RE: Date Formatter for LogKitManagement
>
>
> Good Catch! Chad Stansbury!
>
> Pity, looks like Peter Donald already checked in the original
> Perhaps we can get the more optimal code checked in too?
> Is there an upcoming release of LogKit?
>
>
> -----Original Message-----
> From: Chad Stansbury [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 12, 2001 3:09 PM
>
> For the speed freaks like myself, here's another optimization
> to the Date
> formatter code. You can improve upon the speed by removing the Date
> instantiation (which in the quoted code will be invoked for
> each line being
> logged), and replacing w/ a setTime call... The new code would be:
>
> import java.util.Date;
> import java.text.SimpleDateFormat;
>
> SimpleDateFormat m_dateFormatter = null;
> Date m_date = new Date();
>
> protected String getTime( final long time, final String format )
> {
> if ( format == null ){
> return Long.toString( time );
> }
>
> if (m_dateFormatter == null) {
> m_dateFormatter = new SimpleDateFormat( format );
> }
>
> m_date.setTime( System.currentTimeMillis() );
> return( m_dateformatter.format( m_date ) );
> }
>
> Chad Stansbury
>
>
----------------------------------------- (on the network) ********************************* PRIVILEGED - PRIVATE AND CONFIDENTIAL This e-mail and files transmitted with it are intended solely for the use of the addressee(s) and may contain information which is confidential or privileged. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you receive this e-mail and you are not the addressee, or you have received this e-mail in error, please disregard the contents of the e-mail, delete the e-mail and notify the author immediately. *********************************
---------------------------------------------------------
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>