GPS date_time cracking question.

Hello all. I have a 501 Fastrax GPS unit connected to my Mega2560 and have a small problem I cant seem to solve.

I am using Mikal Harts code.
here is a snippet of code.

int year;
byte month, day, hour, minute, second, hundredths;
unsigned long age;
gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
if (age == TinyGPS::GPS_INVALID_AGE)
Serial.print("******* ******* ");
else
{
char sz[32];

int esthour = (hour-5); //THIS WORKS FOR EST!!!
if (hour >= 05 && hour <= 23) {esthour = (hour-5);}
else {esthour = (hour + 19);}

sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d:%02d ",
month, day, year, esthour, minute, second, hundredths);
Serial.print(sz);
}
print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
feedgps();

The problem I'm having is with the time portion. hundredths of a second is always showing "0" It doesn't write the time to hundredths of a second. Every search I've done has come up with no hundredths of a second time displaying anything other than zero. I am missing something? I want to use this for data logging and time stamping. My logger refreshes at every 100ms so having zeros is a problem with graphing. the graph see multiple events for the same second which just istn right. My other option is to add a timer or id . Id is simple but I cant figure out the timer to write a dataString and show the missing zero for values less than 10 eg. 9 seconds should show as :09 not :9.
Can someone point me in the right direction please?
Thanks!

I am missing something?

A 1Hz update rate?

I cant figure out the timer to write a dataString and show the missing zero for values less than 10 eg. 9 seconds should show as :09 not :9.

I don't know what "dataString" is, but "%02d" should provide a leading zero?
Doesn't it?

Sorry Its more of a 2 part question.

  1. why does the gps not print time to hundredths of a second (it only prints "0") never any kind time to the hundredths of a second.

  2. If gps cant be made to display the time to the hundredth how would I make code that looks like the following print the time to a string.
    elapsedTime = millis() - startTime; // store elapsed time
    elapsedMinutes = (elapsedTime / 60000L); // divide by 60000 to convert to minutes - then cast to an int to print
    elapsedSeconds = (elapsedTime / 1000L); // divide by 1000 to convert to seconds - then cast to an int to print
    elapsedFrames = (elapsedTime / interval); // divide by 40 to convert to 1/25 of a second - then cast to an int to print
    fractional = (int)(elapsedFrames % frameRate);// use modulo operator to get fractional part of 25 Frames
    fractionalSecs = (int)(elapsedSeconds % 60L); // use modulo operator to get fractional part of 60 Seconds
    fractionalMins = (int)(elapsedMinutes % 60L); // use modulo operator to get fractional part of 60 Minutes

if (fractionalMins < 10){ // pad in leading zeros
Serial.print("0"); // add a zero
}

Serial.print(itoa(fractionalMins, buf, 10)); // convert the int to a string and print a fractional part of 60 Minutes to the LCD
Serial.print(":"); //print a colan.

if (fractionalSecs < 10){ // pad in leading zeros
Serial.print("0"); // add a zero
}

Serial.print(itoa(fractionalSecs, buf, 10)); // convert the int to a string and print a fractional part of 60 Seconds to the LCD
Serial.print(":"); //print a colan.

if (fractional < 10){ // pad in leading zeros
Serial.print("0"); // add a zero
}
Serial.print(itoa((fractional), buf, 10)); // convert the int to a string and print a fractional part of 25 Frames to the LCD
Serial.println();
}

I think I gave a two part answer.

With your help I did figure out a timer to work. (sorry im new to arduino and don't understand how the whole sz %02d stuff works.

What is the reason behind the hundredths of a second not printing from gps? I get 7-8 readings under the same second and all the hundredths just read 0.

If the GPS only updates once a second (1Hz), I wouldn't expect to get 1/100 ths of a second.

and don't understand how the whole sz %02d stuff works.

What is "sz"?