GPS shield with Ardunio

Hello,
I met some problem when develop my Ardunio with GPS shield. I want to use it to know location, but this doesn;t work when coding, Here is my code and I think 'encode()' function doesn't work. The attached photo is snapshot from Serial monitor. I should see the latitude and longitude and so on information but now I don't see them. Thank you in advance.

#include <SoftwareSerial.h>
#include <TinyGPS.h>


// Define which pins you will use on the Arduino to communicate with your 
// GPS. In this case, the GPS module's TX pin will connect to the 
// Arduino's RXPIN which is pin 3.



// This is the serial rate for your terminal program. It must be this 
// fast because we need to print everything before a new sentence 
// comes in. If you slow it down, the messages might not be valid and 
// you will likely get checksum errors.
// Set this value equal to the baud rate of your terminal program


// Set this value equal to the baud rate of your GPS


// Create an instance of the TinyGPS object
TinyGPS gps;
// Initialize the NewSoftSerial library to the pins you defined above
//#define RXPIN 2
//#define TXPIN 3
SoftwareSerial dline_gps(2, 3);

// This is where you declare prototypes for the functions that will be 
// using the TinyGPS library.
void getgps(TinyGPS &gps);

// In the setup function, you need to initialize two serial ports; the 
// standard hardware serial port (Serial()) to communicate with your 
// terminal program an another serial port (NewSoftSerial()) for your 
// GPS.
void setup()
{
 
  // Sets baud rate of your terminal program
  //#define TERMBAUD  115200
  Serial.begin(115200);
  
  // Sets baud rate of your GPS
  //#define GPSBAUD  4800
  dline_gps.begin(4800);
  
  Serial.println("");
  Serial.println("GPS Shield QuickStart Example Sketch v12");
  Serial.println("       ...waiting for lock...           ");
  Serial.println("");
}

// This is the main loop of the code. All it does is check for data on 
// the RX pin of the ardiuno, makes sure the data is valid NMEA sentences, 
// then jumps to the getgps() function.
void loop()
{
  
 //   Serial.println("looping");
  while(dline_gps.available())     // While there is data on the RX pin...
  {
    int c = dline_gps.read();    // load the data into a variable...
    
    Serial.write(c);
   
    //Serial.println("gps available");
    
    if(gps.encode(c))      // if there is a new valid sentence...
     {
        // Serial.println("gps reading");
     getgps(gps);         // then grab the data.
     }
     
      
  }
}

// The getgps function will get and print the values we want.
void getgps(TinyGPS &gps)
{
  // To get all of the data into varialbes that you can use in your code, 
  // all you need to do is define variables and query the object for the 
  // data. To see the complete list of functions see keywords.txt file in 
  // the TinyGPS and NewSoftSerial libs.
  
  // Define the variables that will be used
  float latitude, longitude;
  // Then call this function
  gps.f_get_position(&latitude, &longitude);
  // You can now print variables latitude and longitude
  Serial.print("Lat/Long: "); 
  Serial.print(latitude,5); 
  Serial.print(", "); 
  Serial.println(longitude,5);
  
  // Same goes for date and time
  int year;
  byte month, day, hour, minute, second, hundredths;
  gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths);
  // Print data and time
  Serial.print("Date: "); Serial.print(month, DEC); Serial.print("/"); 
  Serial.print(day, DEC); Serial.print("/"); Serial.print(year);
  Serial.print("  Time: "); Serial.print(hour, DEC); Serial.print(":"); 
  Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC); 
  Serial.print("."); Serial.println(hundredths, DEC);
  //Since month, day, hour, minute, second, and hundr
  
  // Here you can print the altitude and course values directly since 
  // there is only one value for the function
  Serial.print("Altitude (meters): "); Serial.println(gps.f_altitude());  
  // Same goes for course
  Serial.print("Course (degrees): "); Serial.println(gps.f_course()); 
  // And same goes for speed
  Serial.print("Speed(kmph): "); Serial.println(gps.f_speed_kmph());
  //Serial.println();
  
  // Here you can print statistics on the sentences.
  unsigned long chars;
  unsigned short sentences, failed_checksum;
  gps.stats(&chars, &sentences, &failed_checksum);
  //Serial.print("Failed Checksums: ");Serial.print(failed_checksum);
  //Serial.println(); Serial.println();
  
  // Here you can print the number of satellites in view
  Serial.print("Satellites: ");
  Serial.println(gps.satellites());
}

Your output is correct, but U got no fix to satellites. Time to move outdoors.

$GPGGA contains time, latitude, longitude and then crucially fix quality. This is non-zero when it has a fix. This is followed by the number of satellites in view.

I now find it work outside but time is not right. Time shows always later one hour. Time should be 16:5:57. Is there any way to fix this?

Thank you very much.

No, because that is the time. it's called GMT, or UTC, depending on where you live.

dannable:
No, because that is the time. it's called GMT, or UTC, depending on where you live.

Thanks.
But why isn't it identical to my PC time when PC and Arduino boards connect?
Thanks again.

That depends on a couple of factors that we don't know the answer to.

Your PC almost certainly does not receive a GPS signal to correct its time. Most PCs connect to a NTP server from time to time to correct their internal clocks. That saves the PC manufacturer money since they can then use less expensive / accurate real time clocks inside the PC to keep time. On the downside, you need a internet connection and many PCs have to be set up to connect to a NTP in the control panel settings for that to work.

As for the GPS time output, it's set to Greenwich Mean Time (GMT) or Coordinated Universal time (UTC). Simply add and subtract the delta from your location in terms of time zones. Usually, time zones increment in hours, though some areas of the world (Nepal, Bhutan, etc.) deviate from that usual increment.

Also, remember that GMT does not shift for summer and winter time (if that's observed in your area).

What I find hilarious is that every car I've driven with an OEM GPS navigation system does not use the GPS data to set/update the 'vehicle time' based on its location (to determine the time zone) and GMT. If an Arduino enthusiast managed to code a GPS clock that sets its time zone based on its location, summer/winter time data, etc., it's hard to believe that car manufacturers lack the resources to do the same. Presumably, a patent protects the idea, hence the lack of implementation.

What I find hilarious is that cars with GPS navigation systems do not use the GPS time stamp to correct the time inside the vehicle.

Mine does, (UK spec Ford Focus) but doesn't correct for summer / daylight saving time! So I have to go into the menu and set a flag for it to display the correct time.

Constantin:
That depends on a couple of factors that we don't know the answer to.

Your PC almost certainly does not receive a GPS signal to correct its time. Most PCs connect to a NTP server from time to time to correct their internal clocks. That saves the PC manufacturer money since they can then use less expensive / accurate real time clocks inside the PC to keep time. On the downside, you need a internet connection and many PCs have to be set up to connect to a NTP in the control panel settings for that to work.

As for the GPS time output, it's set to Greenwich Mean Time (GMT) or Coordinated Universal time (UTC). Simply add and subtract the delta from your location in terms of time zones. Usually, time zones increment in hours, though some areas of the world (Nepal, Bhutan, etc.) deviate from that usual increment.

Also, remember that GMT does not shift for summer and winter time (if that's observed in your area).

What I find hilarious is that every car I've driven with an OEM GPS navigation system does not use the GPS data to set/update the 'vehicle time' based on its location (to determine the time zone) and GMT. If an Arduino enthusiast managed to code a GPS clock that sets its time zone based on its location, summer/winter time data, etc., it's hard to believe that car manufacturers lack the resources to do the same. Presumably, a patent protects the idea, hence the lack of implementation.

Thanks so much.