Well there is not much code there... at all...
If you want to implement something like this, you'll have to be good with large sets of data. And know how to work with GPS data.
You can easily find code that connects to a GPS receiver, and you'll easily find code that decodes the NMEA telegrams from the GPS receiver.
You'll need a 10 Hz update rate from the GPS to make it accurate. Not all GPS receivers can do that.
To time a round on a track you'll need to compare the latest coordinates against a number of past coordinates to determine when you pass the same ground again.
If you know the start/finish line as a line between two coordinate pairs, then it makes the job a lot easier.
There are formulas out there that can tell you when you cross a line, or the perpendicular distance to a line identified by two coordinate pairs. If you can get a sing out of that formula, then you have crossed the line when the distance goes towards zero and changes sign.
On top of all that you'll need to program something to display the lap times, fastest lap etc.
It's not a simple project, so if you don't feel like it you can jump all this and download a GPS lap timer app for your smart phone, for free even.