diff options
-rw-r--r-- | gpsd.h | 5 | ||||
-rw-r--r-- | tsip.c | 4 | ||||
-rw-r--r-- | zodiac.c | 2 |
3 files changed, 8 insertions, 3 deletions
@@ -214,6 +214,11 @@ extern struct protoent *getprotobyname(const char *); extern /*@observer@*/char *strptime(const char *,const char *,/*@out@*/struct tm *tp)/*@modifies tp@*/; extern struct tm *gmtime_r(const time_t *,/*@out@*/struct tm *tp)/*@modifies tp@*/; extern struct tm *localtime_r(const time_t *,/*@out@*/struct tm *tp)/*@modifies tp@*/; +extern float roundf(float x); #endif /* S_SPLINT_S */ +/* BSD port hack */ +#define rint(x) round(x) +#define rintf(x) roundf(x) + #endif /* _gpsd_h_ */ @@ -105,7 +105,7 @@ static bool tsip_speed_switch(struct gps_device_t *session, unsigned int speed) unsigned char buf[100]; putbyte(0,0xff); /* current port */ - putbyte(1,(rint(log((double)speed/300)/M_LN2))+2); /* input baudrate */ + putbyte(1,(round(log((double)speed/300)/M_LN2))+2); /* input baudrate */ putbyte(2,buf[1]); /* output baudrate */ putbyte(3,8); /* character width (8 bits) */ putbyte(4,1); /* parity (odd) */ @@ -175,7 +175,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session) f2 = getf(6); /* leap seconds */ if (f2 > 10.0) { session->gps_week = (unsigned)s1; - session->context->leap_seconds = (int)rintf(f2); + session->context->leap_seconds = (int)roundf(f2); session->context->valid = LEAP_SECOND_VALID; session->gpsdata.sentence_time = gpstime_to_unix(s1, f1) - f2; @@ -93,7 +93,7 @@ static bool zodiac_speed_switch(struct gps_device_t *session, speed_t speed) data[2] = 1; /* port 1 character width (8 bits) */ data[3] = 0; /* port 1 stop bits (1 stopbit) */ data[4] = 0; /* port 1 parity (none) */ - data[5] = (unsigned short)(rint(log((double)speed/300)/M_LN2)+1); /* port 1 speed */ + data[5] = (unsigned short)(round(log((double)speed/300)/M_LN2)+1); /* port 1 speed */ data[14] = zodiac_checksum(data, 14); zodiac_spew(session, 1330, data, 15); |