forked from lgsvl/simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move GPS leap second and UTC-to-GPS conversion
to a new GpsUtils class.
- Loading branch information
1 parent
fe4a1d8
commit 05f7db1
Showing
4 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2020 LG Electronics, Inc. | ||
* | ||
* This software contains code licensed as described in LICENSE. | ||
* | ||
*/ | ||
|
||
using System; | ||
|
||
namespace Simulator.Bridge | ||
{ | ||
static public class GpsUtils | ||
{ | ||
static readonly public DateTime GpsEpoch = new DateTime(1980, 1, 6, 0, 0, 0, DateTimeKind.Utc); | ||
// GPS Time requires leap seconds which is updated every several years. | ||
// https://racelogic.support/01VBOX_Automotive/01General_Information/Knowledge_Base/What_are_GPS_Leap_Seconds%3F | ||
// We keep a single copy of this value here for easy update later. | ||
static readonly public float GpsLeapSeconds = 18.0f; | ||
|
||
static public double UtcToGpsSeconds(DateTime utc) | ||
{ | ||
return (utc - GpsEpoch).TotalSeconds + GpsLeapSeconds; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters