minmea.h: add Windows compatibility layer
This commit is contained in:
parent
ded4faf483
commit
0b02771b28
12
README.md
12
README.md
@ -13,6 +13,7 @@ systems.
|
||||
* No floating point usage in the core library.
|
||||
* Supports both fixed and floating point values.
|
||||
* One source file and one header - can't get any simpler.
|
||||
* Tested under Linux, OS X, Windows and embedded ARM GCC.
|
||||
* Easily extendable to support new sentences.
|
||||
* Complete with a test suite and static analysis.
|
||||
|
||||
@ -29,6 +30,14 @@ systems.
|
||||
|
||||
Adding support for more sentences is trivial; see ``minmea.c`` source. Good documentation on NMEA is at http://www.catb.org/gpsd/NMEA.html
|
||||
|
||||
## Compatibility
|
||||
|
||||
Minmea runs out-of-the-box under most Unix-compatible systems. Support for non-Unix systems
|
||||
(including native Windows builds under MSVC) is provided via compatibility headers:
|
||||
|
||||
1. Define `MINMEA_INCLUDE_COMPAT` in the build environment.
|
||||
2. Add appropriate compatibility header from under `compat/` directory as `minmea_compat.h`.
|
||||
|
||||
## Fractional number format
|
||||
|
||||
Internally, minmea stores fractional numbers as pairs of two integers: ``{value, scale}``.
|
||||
@ -131,8 +140,7 @@ typing ``make``.
|
||||
(or equivalent) to remove the unused functions (parsers) from the final image.
|
||||
* Some systems lack ``timegm``. On these systems, the recommended course of
|
||||
action is to build with ``-Dtimegm=mktime`` which will work correctly as long
|
||||
the system runs in the default ``UTC`` timezone. Native Windows builds should
|
||||
use ``-Dtimegm=_mkgmtime`` instead which will work correctly in all timezones.
|
||||
the system runs in the default ``UTC`` timezone.
|
||||
|
||||
## Bugs
|
||||
|
||||
|
23
compat/minmea_compat_windows.h
Normal file
23
compat/minmea_compat_windows.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright © 2017 Kosma Moczek <kosma@cloudyourcar.com>
|
||||
* This program is free software. It comes without any warranty, to the extent
|
||||
* permitted by applicable law. You can redistribute it and/or modify it under
|
||||
* the terms of the Do What The Fuck You Want To Public License, Version 2, as
|
||||
* published by Sam Hocevar. See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#if !defined(HAVE_STRUCT_TIMESPEC)
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define inline __inline
|
||||
#define timegm _mkgmtime
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set ts=4 sw=4 et: */
|
Loading…
Reference in New Issue
Block a user