00001 /* 00002 * Copyright (C) 2013 Swift Navigation Inc. 00003 * Contact: Fergus Noble <fergus@swift-nav.com> 00004 * 00005 * This source is subject to the license found in the file 'LICENSE' which must 00006 * be be distributed together with this source. All other rights reserved. 00007 * 00008 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 00009 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 00010 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 00011 */ 00012 00013 #ifndef LIBSWIFTNAV_TIME_H 00014 #define LIBSWIFTNAV_TIME_H 00015 00016 #include <time.h> 00017 00018 #include "common.h" 00019 00023 #define GPS_WEEK_CYCLE 1 00024 00028 #define GPS_MINUS_UTC_SECS 16 00029 00031 #define GPS_EPOCH 315964800 00032 00034 typedef struct __attribute__((packed)) { 00035 double tow; 00036 u16 wn; 00037 } gps_time_t; 00038 00039 gps_time_t normalize_gps_time(gps_time_t); 00040 00041 time_t gps2time(gps_time_t t); 00042 00043 double gpsdifftime(gps_time_t end, gps_time_t beginning); 00044 00045 #endif /* LIBSWIFTNAV_TIME_H */ 00046 00047