class SimpleTimestampFormat extends SimpleDateFormat {

  @Override
  public StringBuffer format( Date timestamp, StringBuffer toAppendTo, FieldPosition pos ) {
    if ( compatibleToSuperPattern ) {
      return super.format( timestamp, toAppendTo, pos );
    }

    StringBuffer dateBuffer;
    String nan;

    if ( timestamp instanceof Timestamp ) {
      Timestamp tmp = (Timestamp) timestamp;
      Date date = new Date( tmp.getTime() );
      dateBuffer = super.format( date, toAppendTo, pos );
      nan = formatNanoseconds( tmp.getNanos() );

    } else {
      dateBuffer = super.format( timestamp, toAppendTo, pos );
      String milliseconds = defaultMillisecondDateFormat.format( timestamp );
      nan = formatNanoseconds( Integer.valueOf( milliseconds ) * Math.pow( 10, 6 ) );
    }

    int placeholderPosition = replaceHolder( dateBuffer, false );
    return dateBuffer.insert( pos.getBeginIndex() + placeholderPosition, nan );
  }

  public  SimpleTimestampFormat( String pattern );
  public  SimpleTimestampFormat( String pattern, Locale locale );
  public  SimpleTimestampFormat( String pattern, DateFormatSymbols formatSymbols );

}