Sync RTC with pc time problems

Im using the example code found in the arduino time library under the example called processing.

I am using com port 5.

The code looks like:

/**
 * SyncArduinoClock. 
 *
 * portIndex must be set to the port connected to the Arduino
 * 
 * The current time is sent in response to request message from Arduino 
 * or by clicking the display window 
 *
 * The time message is 11 ASCII text characters; a header (the letter 'T')
 * followed by the ten digit system time (unix time)
 */
 

import processing.serial.*;

public static final short portIndex = 5;  // select the com port, 0 is the first port
public static final char TIME_HEADER = 'T'; //header byte for arduino serial time message 
public static final char TIME_REQUEST = 7;  // ASCII bell character 
public static final char LF = 10;     // ASCII linefeed
public static final char CR = 13;     // ASCII linefeed
Serial myPort;     // Create object from Serial class

void setup() {  
  size(200, 200);
  println(Serial.list());
  println(" Connecting to -> " + Serial.list()[portIndex]);
  myPort = new Serial(this,Serial.list()[portIndex], 9600);
}

void draw()
{
  if ( myPort.available() > 0) {  // If data is available,
    char val = char(myPort.read());         // read it and store it in val
    if(val == TIME_REQUEST){
       long t = getTimeNow();
       sendTimeMessage(TIME_HEADER, t);   
    }
    else
    { 
       if(val == LF)
           ; //igonore
       else if(val == CR)           
         println();
       else  
         print(val); // echo everying but time request
    }
  }  
}

void mousePressed() {  
  sendTimeMessage( TIME_HEADER, getTimeNow());   
}


void sendTimeMessage(char header, long time) {  
  String timeStr = String.valueOf(time);  
  myPort.write(header);  // send header and time to arduino
  myPort.write(timeStr);   
}

long getTimeNow(){
  // java time is in ms, we want secs    
  GregorianCalendar cal = new GregorianCalendar();
  cal.setTime(new Date());
  int	tzo = cal.get(Calendar.ZONE_OFFSET);
  int	dst = cal.get(Calendar.DST_OFFSET);
  long now = (cal.getTimeInMillis() / 1000) ; 
  now = now + (tzo/1000) + (dst/1000); 
  return now;
}

and im getting alot of errors on the serial monitor,

SyncArduinoClock:13: error: 'import' does not name a type
SyncArduinoClock:15: error: expected unqualified-id before 'public'
SyncArduinoClock:16: error: expected unqualified-id before 'public'
SyncArduinoClock:17: error: expected unqualified-id before 'public'
SyncArduinoClock:18: error: expected unqualified-id before 'public'
SyncArduinoClock:19: error: expected unqualified-id before 'public'
SyncArduinoClock:20: error: 'Serial' does not name a type
SyncArduinoClock.cpp: In function 'void setup()':
SyncArduinoClock:23: error: 'size' was not declared in this scope
SyncArduinoClock:24: error: 'class HardwareSerial' has no member named 'list'
SyncArduinoClock:24: error: 'println' was not declared in this scope
SyncArduinoClock:25: error: 'class HardwareSerial' has no member named 'list'
SyncArduinoClock:25: error: 'portIndex' was not declared in this scope
SyncArduinoClock:26: error: 'myPort' was not declared in this scope
SyncArduinoClock:26: error: expected type-specifier before 'Serial'
SyncArduinoClock:26: error: expected `;' before 'Serial'
SyncArduinoClock.cpp: In function 'void draw()':
SyncArduinoClock:31: error: 'myPort' was not declared in this scope
SyncArduinoClock:33: error: 'TIME_REQUEST' was not declared in this scope
SyncArduinoClock:35: error: 'TIME_HEADER' was not declared in this scope
SyncArduinoClock:39: error: 'LF' was not declared in this scope
SyncArduinoClock:41: error: 'CR' was not declared in this scope
SyncArduinoClock:42: error: 'println' was not declared in this scope
SyncArduinoClock:44: error: 'print' was not declared in this scope
SyncArduinoClock.cpp: In function 'void mousePressed()':
SyncArduinoClock:50: error: 'TIME_HEADER' was not declared in this scope
SyncArduinoClock.cpp: In function 'void sendTimeMessage(char, long int)':
SyncArduinoClock:55: error: expected primary-expression before '.' token
SyncArduinoClock:56: error: 'myPort' was not declared in this scope
SyncArduinoClock.cpp: In function 'long int getTimeNow()':
SyncArduinoClock:62: error: 'GregorianCalendar' was not declared in this scope
SyncArduinoClock:62: error: expected `;' before 'cal'
SyncArduinoClock:63: error: 'cal' was not declared in this scope
SyncArduinoClock:63: error: expected type-specifier before 'Date'
SyncArduinoClock:63: error: expected `)' before 'Date'
SyncArduinoClock:64: error: 'Calendar' was not declared in this scope

why? and what should i do?

Are you trying to compile Processing in the Arduino IDE?

Yes i am using the arduino IDE version 22, I am also using the RTC module from seeedstudio, it uses the ds1307 along with most other RTC's

void draw()

That's a dead giveaway.

"import" too.

Why would they post bunk code in the examples? i tried commenting out import blah blah and changed draw to loop, neither worked, same list of errors - the import

The code isn't"bunk", it is Processing, to be compiled in the Processing IDE.