<filename>gpsutils.c</filename> Functions:-Code shared between low-level and high-level interfaces. Most of them do exactly what they say on the tin. Notes based on $Id: gpsutils.c 4108 2006-12-08 11:48:31Z esr $ void gps_clear_fix(struct gps_fix_t *fixp) Stuff a fix structure with recognizable out-of-band values. unsigned int gps_valid_fields(struct gps_fix_t *fixp) Clears certain status flags, depending if the associated fields are invalid. char *gps_show_transfer(int transfer) Takes a mask word and uses it to check certain status flags. If the associated flag is active, the name of the status is written to the return buffer. void gps_merge_fix(struct gps_fix_t *to, gps_mask_t transfer, struct gps_fix_t *from) Merges (overwrites the contents of) an old fix with the contents of a new fix for those fields where the associated bit in the mask word is set and the new fix data is valid. double timestamp(void) Returns the number of seconds and microseconds since the UNIX Epoch (00:00:00 UTC, January 1, 1970); i.e. a unique value which can be used to timestamp any event. time_t mkgmtime(register struct tm *t) Convert a struct tm {} (see time.h) to seconds since UNIX Epoch. double iso8601_to_unix(char *isotime) Convert an ISO8601 UTC string (like 2006-01-25T13:15:22.9) to Unix UTC. char *unix_to_iso8601(double fixtime, char isotime[], int len) Reverse of the above, no timezone adjustment. double gpstime_to_unix(int week, double tow) Convert gps time to UNIX time, allowing for the gps week number rollover. void unix_to_gpstime(double unixtime, int *week, double *tow) Reverse of the above. static double CalcRad(double lat) Return the earth's radius of curvature in meters at specified latitude. double earth_distance(double lat1, double lon1, double lat2, double lon2) Return the distance in meters between two points specified in degrees. static int invert(double mat[4][4], double inverse[4][4]) Try and invert an array. If it is possible, fill the inverted array and return a 1. Return a 0 if it is not possible. gps_mask_t dop(struct gps_data_t *gpsdata) Take a gps data structure and try to calculate the DOP values from the other data in it. Return 0 if it is not possible or update the appropriate DOP fields in the structure and set a mask which tells which fields were updated.