From 576609273215a0bc2fb0390124c026b63a309f70 Mon Sep 17 00:00:00 2001 From: mlichvar Date: Mon, 21 May 2007 13:15:11 +0000 Subject: [PATCH] - cope with backward system time jumps (#240691) --- form.c | 11 +++++++---- newt.spec | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/form.c b/form.c index 12df175..075c13d 100644 --- a/form.c +++ b/form.c @@ -942,16 +942,19 @@ void newtFormRun(newtComponent co, struct newtExitStruct * es) { if (form->timer) { /* Calculate when we next need to return with a timeout. Do this inside the loop in case a callback resets the timer. */ - if (!form->lastTimeout.tv_sec && !form->lastTimeout.tv_usec) - gettimeofday(&form->lastTimeout, NULL); + gettimeofday(&now, 0); + + if ((!form->lastTimeout.tv_sec && !form->lastTimeout.tv_usec) || + now.tv_sec < form->lastTimeout.tv_sec || + (now.tv_sec == form->lastTimeout.tv_sec && + now.tv_usec < form->lastTimeout.tv_usec)) + form->lastTimeout = now; nextTimeout.tv_sec = form->lastTimeout.tv_sec + (form->timer / 1000); nextTimeout.tv_usec = form->lastTimeout.tv_usec + (form->timer % 1000) * 1000; - gettimeofday(&now, 0); - if (now.tv_sec > nextTimeout.tv_sec) { timeout.tv_sec = timeout.tv_usec = 0; } else if (now.tv_sec == nextTimeout.tv_sec) { diff --git a/newt.spec b/newt.spec index ca10eec..66280cf 100644 --- a/newt.spec +++ b/newt.spec @@ -88,6 +88,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libnewt.a %changelog +- cope with backward system time jumps (#240691) - free helplines and windows in newtFinished, check for overflow (#239992) - add release to -devel and -static requires (#238784) - fix cursor positioning when setting entry or checkbox flags -- 2.39.2