Convert UTC to GPS time

3.3k views Asked by At

As described here and here, there is a difference between UTC and GPS Time because UTC occasionally has a leap second applied.

As of 2021 the difference is 18 seconds. So currently the equation is:

var gpsTime = utcDate.AddSeconds(18);

I need to calculate the gpsTime for all kinds of dates (past and near future). I could store a list of leap seconds and work out the GPS delta in play at any particular date. But I don't want the future maintainers of this code to have to remember to manually update the list whenever a new leap second comes along. Rather, it would be nice to use a library (maintained by the open source community) which is always up to date.

So is anyone aware of a library which can either:

  1. Convert UTC to GPS time, or
  2. Provide a list of Leap seconds?

Do any of these exist within the .NET framework or in some library on Nuget?

0

There are 0 answers