diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-04-02 15:58:55 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-04-02 16:03:29 +0200 |
| commit | e5c4c1415bff4ae5e08a7d1ec7cdcce3ba589eb2 (patch) | |
| tree | 302a1a71e7ab6bb99c6b003e05faa01e16374754 /src | |
| parent | 7a879568b3fd16ce84ee4fa3e268272eb53fc590 (diff) | |
Add replacement for potentially missing trunc() (#944)
- add configure + CMake checks to define HAVE_TRUNC in config.h
- src/Fl_Timeout.cxx: add local replacement function
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Timeout.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Fl_Timeout.cxx b/src/Fl_Timeout.cxx index bc3d0cb84..921c40c75 100644 --- a/src/Fl_Timeout.cxx +++ b/src/Fl_Timeout.cxx @@ -2,7 +2,7 @@ // Timeout support functions for the Fast Light Tool Kit (FLTK). // // Author: Albrecht Schlosser -// Copyright 2021-2023 by Bill Spitzak and others. +// Copyright 2021-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -15,12 +15,18 @@ // https://www.fltk.org/bugs.php // +#include <config.h> + #include "Fl_Timeout.h" #include "Fl_System_Driver.H" #include <stdio.h> #include <math.h> // for trunc() +#if !HAVE_TRUNC +static inline double trunc(double x) { x >= 0 ? floor(x) : ceil(x); } +#endif // !HAVE_TRUNC + /** \file Fl_Timeout.cxx */ |
