Well, if you guys are discussing date formatting issues, I'd like to bring up something myself. I didn't have the time, yet, to make a patch (SORRY!), but to fix a little problem it would by handy if there was also a getRTime() method for relative timestamps. When formatting relative timestamps the timezone information is irrelevant and results in not so beatiful values to be printed out (+/- n hours) . Yes, I know, this is a minor thing, but it would be nice to have and quick to implement. What do you think?
On Wed, 12 Dec 2001 15:38:38 -0800 Bian Tan wrote: > 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 > Cheers, Jeremias Märki mailto:[EMAIL PROTECTED] Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029 Internet http://www.outline.ch -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>