Small utility to convert times between GPS epoch (midnight January 6, 1980) and Unix epoch (midnight January 1, 1970), taking into account leap seconds.
No dependencies! Very small: 464 bytes gzipped.
Works on the client and on the server (in Node.js).
npm i --save gps-time
AMD and CommonJS are supported, with a fallback that defines this utility at window.gpsTime
In Node, you can bring in this utility with this:
var gpsTime = ;
Converting from Unix time to GPS time.
var unixMS = Date; // 1454168480000gpsTime; // 1138203697000
Converting from GPS time to Unix time.
var gpsMS = 1138203697000;gpsTime; // 1454168480000
This comes with a small test suite which can be run like this:
$ npm install --dev $ npm test