Defines | Functions | Variables
gpstime.h File Reference
#include <time.h>
#include "common.h"
Include dependency graph for gpstime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define GPS_EPOCH   315964800
#define GPS_MINUS_UTC_SECS   16
#define GPS_WEEK_CYCLE   1

Functions

struct __attribute__ ((packed))
time_t gps2time (gps_time_t t)
double gpsdifftime (gps_time_t end, gps_time_t beginning)
gps_time_t normalize_gps_time (gps_time_t)

Variables

 gps_time_t

Define Documentation

#define GPS_EPOCH   315964800

Unix timestamp of the GPS epoch 1980-01-06 00:00:00 UTC

Definition at line 31 of file gpstime.h.

#define GPS_MINUS_UTC_SECS   16

Offset between GPS and UTC times in seconds. Update when a new leap second is inserted and be careful about times in the past when this offset was different.

Definition at line 28 of file gpstime.h.

#define GPS_WEEK_CYCLE   1

Number of rollovers in the 10-bit broadcast GPS week number. Update on next rollover on April 7, 2019.

Todo:
Detect and handle rollover more gracefully.

Definition at line 23 of file gpstime.h.


Function Documentation

struct __attribute__ ( (packed)  ) [read]

Structure representing a GPS time.

< Seconds since the GPS start of week.

< GPS week number.

Definition at line 34 of file gpstime.h.

time_t gps2time ( gps_time_t  gps_t)

Convert a `gps_time_t` GPS time to a Unix `time_t`.

Note:
Adjusts for leap seconds using the current constant offset.
Parameters:
tGPS time struct.
Returns:
Unix time.

Definition at line 45 of file gpstime.c.

double gpsdifftime ( gps_time_t  end,
gps_time_t  beginning 
)

Time difference in seconds between two GPS times.

Parameters:
endHigher bound of the time interval whose length is calculated.
beginningLower bound of the time interval whose length is calculated. If this describes a time point later than end, the result is negative.
Returns:
The time difference in seconds between `beginning` and `end`.

Definition at line 62 of file gpstime.c.

Normalize a `gps_time_t` GPS time struct. Ensures that the time of week is greater than zero and less than one week by wrapping and adjusting the week number accordingly.

Parameters:
tGPS time struct.
Returns:
Normalized GPS time struct.

Definition at line 24 of file gpstime.c.


Variable Documentation

Definition at line 37 of file gpstime.h.



enu
Author(s): Mike Purvis
autogenerated on Fri Jan 3 2014 11:21:07