diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2019-03-12 17:21:53 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2019-03-12 17:21:53 +0100 |
| commit | bab61a93d6167a552a76e538ec2929bf3eb3bb36 (patch) | |
| tree | 78b8d847cb20f155f6572a55ad32938983a91882 /src/Fl_Clock.cxx | |
| parent | 4324acc6f6f2bdbf9c86cf08b458c1c0e96e5ae1 (diff) | |
Prevent unnecessary Fl_Clock timer events (STR 3516)
See documentation @ STR 3516
Diffstat (limited to 'src/Fl_Clock.cxx')
| -rw-r--r-- | src/Fl_Clock.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Fl_Clock.cxx b/src/Fl_Clock.cxx index a9271452b..ca7237212 100644 --- a/src/Fl_Clock.cxx +++ b/src/Fl_Clock.cxx @@ -213,7 +213,10 @@ static void tick(void *v) { int usec; Fl::system_driver()->gettime(&sec, &usec); ((Fl_Clock*)v)->value((ulong)sec); - Fl::add_timeout((1000000 - usec)/1000000., tick, v); // time till next second + + // schedule timer event slightly later than the next second (+25 ms) + // to prevent multiple timer events if triggered too early (STR 3516) + Fl::add_timeout((1025000 - usec)/1000000., tick, v); } int Fl_Clock::handle(int event) { |
