You can see how to send Data to Arduino by studying the Processing Serial examples. There is Arduino code at the end of the Processing example sketches. In Processing, select : Files/Examples/Libraries/Serial/
I have added some more comments to help clarify how the Arduino sketch gets the time.
void getPCtime() {
// if time available from serial port, sync the DateTime library
// a time message consists of a header followed by ten digits (TIME_MSG_LEN equals 11)
while(Serial.available() >= TIME_MSG_LEN ){ // time message
// you make sure you have the start of the message by checking the header
if( Serial.read() == TIME_HEADER ) {
// header was found so get the next ten digits and convert to a number
time_t pctime = 0;
for(int i=0; i < TIME_MSG_LEN -1; i++){
char c= Serial.read();
if( c >= '0' && c <= '9')
pctime = (10 * pctime) + (c - '0') ; // convert digits to a number
// the ASCII character is converted to a digit by subtracting '0' which has an ASCII value 48.
// So, if ch equals '1', its ASCII value is 49. 49- '0' is the same as 49-48 and they both equal 1,
// which is the numeric value of the character '1'
}
// the next method sets the clock with the pc time received above
DateTime.sync(pctime); // Sync DateTime clock to the time received on the serial port
}
}
}