windows: Fix a build error.

serialport.c: In function 'get_time':
  serialport.c:64:6: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
    if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
        ^
  serialport.c:64:20: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
    if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
                      ^
  serialport.c:64:20: note: each undeclared identifier is reported only once for each function it appears in
  serialport.c:65:17: error: 'CLOCK_REALTIME' undeclared (first use in this function)
     clock_gettime(CLOCK_REALTIME, &ts);
                   ^
  serialport.c: At top level:
  serialport.c:60:13: warning: 'get_time' defined but not used [-Wunused-function]
   static void get_time(struct timeval *time)
               ^
This commit is contained in:
Uwe Hermann 2019-12-28 23:39:15 +01:00
parent 7fb9a7b0a7
commit bd0fb6094f
1 changed files with 2 additions and 2 deletions

View File

@ -49,14 +49,13 @@ static const struct std_baudrate std_baudrates[] = {
void (*sp_debug_handler)(const char *format, ...) = sp_default_debug_handler;
static void get_time(struct timeval *time);
static enum sp_return get_config(struct sp_port *port, struct port_data *data,
struct sp_port_config *config);
static enum sp_return set_config(struct sp_port *port, struct port_data *data,
const struct sp_port_config *config);
#ifndef _WIN32
static void get_time(struct timeval *time)
{
#ifdef HAVE_CLOCK_GETTIME
@ -76,6 +75,7 @@ static void get_time(struct timeval *time)
gettimeofday(time, NULL);
#endif
}
#endif
SP_API enum sp_return sp_get_port_by_name(const char *portname, struct sp_port **port_ptr)
{