Skip to content

Commit ca86c17

Browse files
author
mhugent
committedFeb 3, 2010
fix for gps date
git-svn-id: http://svn.osgeo.org/qgis/trunk@12867 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 95190d9 commit ca86c17

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
 

‎src/core/gps/qgsnmeaconnection.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,18 @@ void QgsNMEAConnection::processRMCSentence( const char* data, int len )
180180
mLastGPSInformation.direction = result.direction;
181181

182182
//date and time
183-
QDate date( result.utc.year, result.utc.day, result.utc.sec );
183+
QDate date( result.utc.year, result.utc.mon + 1, result.utc.day );
184184
QTime time( result.utc.hour, result.utc.min, result.utc.sec );
185-
mLastGPSInformation.utcDateTime.setTimeSpec( Qt::UTC );
186-
mLastGPSInformation.utcDateTime.setDate( date );
187-
mLastGPSInformation.utcDateTime.setTime( time );
185+
if ( date.isValid() && time.isValid() )
186+
{
187+
mLastGPSInformation.utcDateTime.setTimeSpec( Qt::UTC );
188+
mLastGPSInformation.utcDateTime.setDate( date );
189+
mLastGPSInformation.utcDateTime.setTime( time );
190+
QgsDebugMsg( "utc time:" );
191+
QgsDebugMsg( mLastGPSInformation.utcDateTime.toString() );
192+
QgsDebugMsg( "local time:" );
193+
QgsDebugMsg( mLastGPSInformation.utcDateTime.toLocalTime().toString() );
194+
}
188195
}
189196
}
190197

0 commit comments

Comments
 (0)
Please sign in to comment.