Deleted Added
full compact
gpstolfp.c (280849) gpstolfp.c (282408)
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>

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

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"
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>

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

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"
37#include "ntp_calendar.h"
38#include "parse.h"
37
39
38#define GPSORIGIN 2524953600UL /* NTP origin - GPS origin in seconds */
39#define SECSPERWEEK (unsigned)(604800) /* seconds per week - GPS tells us about weeks */
40#define GPSWRAP 990 /* assume week count less than this in the previous epoch */
41
42void
43gpstolfp(
44 int weeks,
45 int days,
46 unsigned long seconds,
47 l_fp * lfp
48 )
49{
50 if (weeks < GPSWRAP)
51 {
40void
41gpstolfp(
42 int weeks,
43 int days,
44 unsigned long seconds,
45 l_fp * lfp
46 )
47{
48 if (weeks < GPSWRAP)
49 {
52 weeks += 1024;
50 weeks += GPSWEEKS;
53 }
54
51 }
52
55 lfp->l_ui = weeks * SECSPERWEEK + days * 86400 + seconds + GPSORIGIN; /* convert to NTP time */
53 lfp->l_ui = (uint32_t)(weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN); /* convert to NTP time */
56 lfp->l_uf = 0;
57}
58
59/*
60 * History:
61 *
62 * gpstolfp.c,v
63 * Revision 4.8 2005/04/16 17:32:10 kardel

--- 14 unchanged lines hidden ---
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 ---