GPS time-date

i m using Tinygps++ library but i cant getting the accurate time, as i got time as 11:80:2 (correct time/expected time-12:20:2)
sometime it gives correct time.

so can anybody help me?

is there any procedure to handel the hundredth() function from gps library

this is my code-

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
This sample code demonstrates just about every built-in operation of TinyGPS++ (TinyGPSPlus).
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(4, 3);

// For stats that happen every 5 seconds
unsigned long last = 0UL;

void setup()
{
Serial.begin(115200);
ss.begin(9600);

Serial.println(F("InteliDemics.com"));
Serial.println(F("Demonstrating nearly every feature of TinyGPS++"));
Serial.print(F("Testing TinyGPS++ library version: ")); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F("by Ganesh Gaikwad"));
Serial.println();
}

void loop()
{
// Dispatch incoming characters
while (ss.available() > 0)
gps.encode(ss.read());

if (gps.location.isUpdated())
{
Serial.print(F("LOCATION: "));
Serial.print(F(" Lat="));
Serial.print(gps.location.lat(), 6);
Serial.print(F(" Long="));
Serial.println(gps.location.lng(), 6);
}

else if (gps.date.isUpdated())
{
Serial.print(F("DATE: "));
Serial.print(gps.date.year());
Serial.print(F("/"));
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.println(gps.date.day());
}

else if (gps.time.isUpdated())
{
Serial.print(F("TIME: "));
Serial.print(gps.time.hour() + 5);
Serial.print(F(":"));
Serial.print(gps.time.minute() + 30);
Serial.print(F(":"));
Serial.println(gps.time.second());

}

else if (gps.speed.isUpdated())
{
Serial.print(F("SPEED: "));
Serial.print(F(" MPH="));
Serial.print(gps.speed.mph());
Serial.print(F(" m/s="));
Serial.print(gps.speed.mps());
Serial.print(F(" km/h="));
Serial.println(gps.speed.kmph());
}

else if (gps.course.isUpdated())
{
Serial.print(F("COURSE: "));
Serial.print(F(" Deg="));
Serial.println(gps.course.deg());
}

else if (gps.altitude.isUpdated())
{
Serial.print(F("ALTITUDE: "));
Serial.print(F(" Meters="));
Serial.print(gps.altitude.meters());
Serial.print(F(" Miles="));
Serial.print(gps.altitude.miles());
Serial.print(F(" KM="));
Serial.print(gps.altitude.kilometers());
Serial.print(F(" Feet="));
Serial.println(gps.altitude.feet());
}

else if (gps.satellites.isUpdated())
{
Serial.print(F("SATELLITES: "));
Serial.println(gps.satellites.value());
}

}

You are doing the math wrong when you add 5 hours and 30 minutes to the GPS time.

6:50:02 plus 5:30:00 is not 11:80:02... it is 12:20:02.

First add 30 to the minutes. If the answer is >59, subtract 60 and add 1 to the hour.

THEN add 5 to the hour. If the answer is >23, subtract 24 and add 1 to the day.

If the day is then greater than the number of days in the month (Remember that February changes length in leap years) set the day to 1 and add 1 to the month.

If the month is then greater than 12, subtract 12 from the month and add one to the year.

It is quite complicated and you should probably find a library that can do the math for you.

NeoGPS has time and date functions for timezone offsets. Here is a NeoGPS version of your sketch that uses the clock_t and time_t types to do that complicated calculation:

/*
   This sample code demonstrates features of NeoGPS
*/

#include <NMEAGPS.h>
NMEAGPS gps;

//----------------------------------------------------------------
// Pick one of these for your GPS serial port and uncomment it:

// 1st CHOICE: For a Mega, Due or Leo, use the extra built-in HardwareSerial port.
//       On a Mega, you could also use Serial2 or Serial3
//#define gpsPort Serial1

// 2nd BEST: For UNO, Micro, Mini and other 328-based boards must use pins 8 & 9.
//      Very efficient!  (Other boards require different pins.)
//#include <AltSoftSerial.h>
//AltSoftSerial gpsPort;

// 3rd BEST: Same boards, but you can't use required pins 8 & 9 (are you sure?)
//       GPS baud rates 9600, 19200 or 38400.  Almost as efficient.
//#include <NeoSWSerial.h>
//NeoSWSerial gpsPort( 4, 3 );

// WORST:  If you can't use baud rates 9600, 19200 or 38400 (are you sure?)
//        SoftwareSerial disables interrupts for long periods of time.
//        *** This will interfere with other parts of your sketch! ***
#include <SoftwareSerial.h>
SoftwareSerial gpsPort( 4, 3 );


void setup()
{
  Serial.begin(115200);
  gpsPort.begin(9600);

  Serial.println(F("InteliDemics.com\n"
                   "Demonstrating some features of NeoGPS\n"
                   "by Ganesh Gaikwad\n\n") );
}

void loop()
{
  // Dispatch incoming characters
  while (gps.available( gpsPort )) {
    gps_fix fix = gps.read();

    Serial.print(F("LOCATION:   Lat="));
    if (fix.valid.location)
    {
      Serial.print( fix.latitude(), 6 );
      Serial.print( F(" Long=") );
      Serial.print( fix.longitude(), 6 );
    }
    Serial.println();

    Serial.print(F("DATE:  "));
    if (fix.valid.date && fix.valid.time)
    {
      // Shift the date/time to local time
      NeoGPS::clock_t localSeconds;
      NeoGPS::time_t  localTime;
      {
        using namespace NeoGPS; // save a little typing below...

        localSeconds = (clock_t) fix.dateTime; // convert structure to a second count
        localSeconds += 5 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE; // shift timezone
        localTime = localSeconds;              // convert back to a structure
      }

      Serial.print( localTime.year );
      Serial.print( '/' );
      Serial.print( localTime.month );
      Serial.print( '/' );
      Serial.println( localTime.date );

      Serial.print( F("TIME:  "));
      Serial.print( localTime.hours );
      Serial.print( ':' );
      Serial.print( localTime.minutes );
      Serial.print( ':' );
      Serial.print( localTime.seconds );
    }
    Serial.println();

    Serial.print(F("SPEED:   MPH="));
    if (fix.valid.speed)
    {
      Serial.print( fix.speed_mph() );
      Serial.print( F(" km/h="));
      Serial.print( fix.speed_kph() );
    }
    Serial.println();

    Serial.print(F("COURSE:   Deg="));
    if (fix.valid.heading)
    {
      Serial.print( fix.heading() );
    }
    Serial.println();

    Serial.print(F("ALTITUDE:   Meters="));
    if (fix.valid.altitude)
    {
      Serial.print( fix.altitude());
    }
    Serial.println();

    Serial.print( F("SATELLITES:  ") );
    if (fix.valid.satellites)
    {
      Serial.print( fix.satellites );
    }
    Serial.println();
  }
}

It will correctly shift the time and date, even if it crosses into a different day, month or year. To do these kind of calculations, it is best to convert the ddmmyy/hhmmss into a seconds count from a time "origin", or starting point (aka EPOCH). Then add the 5 hours and 30 minutes (in seconds). Then convert that seconds count back to a time structure of ddmmyy/hhmmss.

If you want to try it, NeoGPS is available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries. Even if you don't try it, be sure to read the Troubleshooting page for other tips for GPS sketches.

I would also recommend putting the GPS device on pins 8 & 9 so you can use AltSoftSerial instead of SoftwareSerial. ALtSoftSerial is much more efficient. If you can't move to those pins, you should use NeoSWSerial.