Deleted Added
full compact
gpstolfp.c (302408) gpstolfp.c (181834)
1/*
2 * /src/NTP/ntp4-dev/libntp/gpstolfp.c,v 4.8 2005/04/16 17:32:10 kardel RELEASE_20050508_A
3 *
4 * gpstolfp.c,v 4.8 2005/04/16 17:32:10 kardel RELEASE_20050508_A
5 *
6 * $Created: Sun Jun 28 16:30:38 1998 $
7 *
8 * Copyright (c) 1998-2005 by Frank Kardel <kardel <AT> ntp.org>

--- 18 unchanged lines hidden (view full) ---

27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 */
1/*
2 * /src/NTP/ntp4-dev/libntp/gpstolfp.c,v 4.8 2005/04/16 17:32:10 kardel RELEASE_20050508_A
3 *
4 * gpstolfp.c,v 4.8 2005/04/16 17:32:10 kardel RELEASE_20050508_A
5 *
6 * $Created: Sun Jun 28 16:30:38 1998 $
7 *
8 * Copyright (c) 1998-2005 by Frank Kardel <kardel <AT> ntp.org>

--- 18 unchanged lines hidden (view full) ---

27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 */
35#include <config.h>
36#include "ntp_fp.h"
35#include "ntp_fp.h"
37#include "ntp_calendar.h"
38#include "parse.h"
39
36
37#define GPSORIGIN ULONG_CONST(2524953600) /* NTP origin - GPS origin in seconds */
38#define SECSPERWEEK (unsigned)(604800) /* seconds per week - GPS tells us about weeks */
39#define GPSWRAP 990 /* assume week count less than this in the previous epoch */
40
40void
41gpstolfp(
42 int weeks,
43 int days,
44 unsigned long seconds,
45 l_fp * lfp
46 )
47{
48 if (weeks < GPSWRAP)
49 {
41void
42gpstolfp(
43 int weeks,
44 int days,
45 unsigned long seconds,
46 l_fp * lfp
47 )
48{
49 if (weeks < GPSWRAP)
50 {
50 weeks += GPSWEEKS;
51 weeks += 1024;
51 }
52
52 }
53
53 lfp->l_ui = (uint32_t)(weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN); /* convert to NTP time */
54 lfp->l_ui = weeks * SECSPERWEEK + days * 86400 + seconds + GPSORIGIN; /* convert to NTP time */
54 lfp->l_uf = 0;
55}
56
57/*
58 * History:
59 *
60 * gpstolfp.c,v
61 * Revision 4.8 2005/04/16 17:32:10 kardel

--- 14 unchanged lines hidden ---
55 lfp->l_uf = 0;
56}
57
58/*
59 * History:
60 *
61 * gpstolfp.c,v
62 * Revision 4.8 2005/04/16 17:32:10 kardel

--- 14 unchanged lines hidden ---