passing time value from PHP to arduino [Solved]

OK, I have been banging my head over this for the last day and getting close but no good.

I have arduino with ethernet shield and it is reading from a php webpage that simply echo time();

on the arduino side, I read this with char instring.

when i print instring I get the correct value

instring = 1327202474 which is a char array
and when i convert char to time_ t type using time_t timeValue = atoi(inString) timevalue when set to time_t results in 4294934968 and time is like feb 6 2106.

i am setting the arduino clock with ** setTime(timevalue);**

I would paste the code but it has been chopped up pretty badly due to cut and paste from examples and debuggin. Hopefully this is enough info to help a beginner…


any idea what is going on?

EDIT : Somehow could not get atoi(), so reverted to the example code for time serial using

for(int i=0; i < TIME_MSG_LEN -1; i++){   
        char c = inString[i];          
        if( c >= '0' && c <= '9'){   
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number    
      setTime(pctime);   // Sync Arduino clock to the time received on the serial port

Somehow could not get atoi(),

Couldn't get it? Or couldn't get it to work?

If it is latter, and this is true:

instring = 1327202474 which is a char array

What size shoehorn do you have available to stuff that value into an int?

Do you know what the i on atoi() means?