title: Convert UTC to GPS time
body: <p>As described <a href="https://confluence.qps.nl/qinsy/latest/en/utc-to-gps-time-correction-32245263.html#UTCtoGPSTimeCorrection-UTCtoGPSTimeConversionTable" rel="nofollow noreferrer">here</a> and <a href="https://en.wikipedia.org/wiki/Global_Positioning_System#Leap_seconds" rel="nofollow noreferrer">here</a>, there is a difference between UTC and GPS Time because UTC occasionally has a leap second applied.</p>
  <p>As of 2021 the difference is 18 seconds. So currently the equation is:</p>
  <pre><code>var gpsTime = utcDate.AddSeconds(18);
  </code></pre>
  <p>I need to calculate the gpsTime for all kinds of dates (past and near future). I could store a <a href="https://www.ietf.org/timezones/data/leap-seconds.list" rel="nofollow noreferrer">list of leap seconds</a> 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.</p>
  <p>So is anyone aware of a library which can either:</p>
  <ol>
  <li>Convert UTC to GPS time, or</li>
  <li>Provide a list of Leap seconds?</li>
  </ol>
  <p>Do any of these exist within the .NET framework or in some library on Nuget?</p>