diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-12-27 12:27:33 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-12-27 12:27:33 +0100 |
| commit | a234ba7f332e42d24c3bf432fc5b529b5735b4bb (patch) | |
| tree | f1553cc92d973baaa7d0198f5e1613b78e7703db /src | |
| parent | 07c2ba56da4e9ca3ad8d7eb02da9faa180183a99 (diff) | |
| parent | 3701950a90e0b57d4a64e9ca26c1616cbc386c39 (diff) | |
Merge branch 'master' of https://github.com/fltk/fltk
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Clock.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Fl_Clock.cxx b/src/Fl_Clock.cxx index ca7237212..4d7f21e47 100644 --- a/src/Fl_Clock.cxx +++ b/src/Fl_Clock.cxx @@ -212,11 +212,16 @@ static void tick(void *v) { time_t sec; int usec; Fl::system_driver()->gettime(&sec, &usec); + double delta = (1000000 - usec)/1000000.; // time till next second + // if current time is just before full second, show that full second + // and wait one more second (STR 3516) + if (delta < 0.1) { + delta += 1.0; + sec++; + } ((Fl_Clock*)v)->value((ulong)sec); - // 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); + Fl::add_timeout(delta, tick, v); } int Fl_Clock::handle(int event) { |
