Understanding time.now()

This issue has been driving me crazy:

I'm logging events on a file in a SD card, every minute I write into the file the time.now() value and the values of different sensors in a simple CSV file, all is working great except that sometimes the output of the now() number goes negative. I'm sure it has something to do with the type of variable the now() function returns but can't find information on how it is handled.
Anyway here is how some of the output from the file looks like on my serial monitor:
1357092120,31.04,61,7.00,120,1200,1,1,1,0,0
1357092180,31.04,61,7.00,120,1200,1,1,1,0,0
1357092240,31.04,61,7.00,120,1200,1,1,1,0,0
1357092300,31.04,60,7.00,120,1200,1,1,1,0,0
1357092360,30.72,61,7.00,120,1200,1,1,1,0,0
1357092420,30.72,60,7.00,120,1200,1,1,1,0,0
1357092480,31.04,61,7.00,120,1200,1,1,1,0,0
1357092540,30.72,60,7.00,120,1200,1,1,1,0,0
1357092600,30.72,61,7.00,120,1200,1,1,1,0,0
1357092660,31.04,60,7.00,120,1200,1,1,1,0,0
-1423109715,31.37,60,7.00,120,1200,0,1,1,0,0
-1423109656,31.69,61,7.00,120,1200,0,0,1,0,0
-1423109596,31.69,61,7.00,120,1200,0,0,1,0,0

See how is logging every 60 seconds and suddenly it goes negative ? I've been trying to figure it out for days so I decided to ask for help understanding whats the problem.
I write to the file like this:

  myFile = SD.open("log.csv", FILE_WRITE);
        myFile.print ( now() ) ;
      myFile.print (',') ;
        myFile.print (Celsius) ;
        myFile.print (',') ;

etc.....

And read from the file like this to send it over serial to the computer:

  myFile = SD.open("log.csv");

  // if the file is available, send it over Serial:
  if (myFile) {
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    myFile.close();

For some reason some numbers get turned into negatives at some point in time.

Any help with this is greatly appreciated.

Hi, I think you will need to post your sketch please, use # code tags to display it properly formated in your post.

Tom..... :slight_smile:

The sketch is way too long to post here...
The relevant parts are the ones I posted in my first post. I just dont understand what kind of integer is the now() number and what would cause for it to suddenly start being saved as a negative number.
If someone can explain very briefly what kind of data the now() function returns would be a lot of help... Been banging my head against it for days, very frustrating...

mfacen:
I'm sure it has something to do with the type of variable the now() function returns

It returns a time_t variable, which is unsigned.