From: Eli Carter <eli.carter@inet.com>
To: John Being <olonho@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: strange nonmonotonic behavior of gettimeoftheday
Date: Fri, 02 Mar 2001 09:07:32 -0600 [thread overview]
Message-ID: <3A9FB734.6912206F@inet.com> (raw)
In-Reply-To: <F104TJcu8Puwo7hGP4E00009f3d@hotmail.com>
John Being wrote:
>
> I've got following problem with 2.2.17 (Redhat stock kernel)
> Linux ***** 2.2.17-14 #1 Mon Feb 5 14:57:25 EST 2001 i586 unknown
> on AMD K6, VIA Technologies VT 82C586, Compaq Presario XL119.
> Following C program
> #include <stdio.h>
> #include <sys/time.h>
> #include <unistd.h>
> #include <time.h>
> #define ABS(x) (x < 0 ? -x : x)
> #define TIME_T struct timeval
> #define TIME_DIFF_T long
> #define GET_TIME(x) gettimeofday(&x, NULL)
> #define TIME_DIFF(x1, x2) ((x2.tv_sec - x1.tv_sec)*1000000 + (x2.tv_usec -
> x1.tv_usec))
> int main(int argc, char** argv)
> {
> TIME_T t1, t2;
> TIME_DIFF_T d;
>
> GET_TIME(t2);
> while (1) {
> GET_TIME(t1);
> d = TIME_DIFF(t2, t1);
> if (d > 500000 || d < 0) {
> fprintf(stderr, "Leap found: %ld msec\n", d);
> return 0;
> }
> t2 = t1;
> }
> return 1;
>
> gives following result on box in question
> root@******:# ./clo
> Leap found: -1687 msec
> and prints nothing on all other my boxes.
> This gives me bunch of troubles with occasional hang ups and I found nothing
> in kernel archives at
> http://www.uwsg.indiana.edu/hypermail/linux/kernel/index.html
> just some notes about smth like this for SMP boxes with ntp. Is this issue
> known, and how can I fix it?
(That should read "usec" since you are printing microseconds and not
milliseconds.)
I've seen behaviour like that on an ARM processor because the time code
was not considering missed (or rather, delayed response to) timer
interrupts. The time jump in that case was slightly less than 1 jiffie
(jiffie = 10ms). It's likely rather hardware specific; see if you can
get someone with the same hardware to run your test code.
Eli
-----------------------. Rule of Accuracy: When working toward
Eli Carter | the solution of a problem, it always
eli.carter(at)inet.com `------------------ helps if you know the answer.
next prev parent reply other threads:[~2001-03-02 15:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-02 5:30 strange nonmonotonic behavior of gettimeoftheday John Being
2001-03-02 15:07 ` Eli Carter [this message]
2001-03-02 15:08 ` strange nonmonotonic behavior of gettimeoftheday -- seen similar problem on PPC Christopher Friesen
2001-03-02 15:40 ` Richard B. Johnson
2001-03-02 18:25 ` george anzinger
2001-03-02 19:14 ` Richard B. Johnson
2001-03-02 20:09 ` george anzinger
2001-03-03 7:42 ` Mike Galbraith
2001-03-03 22:40 ` dean gaudet
-- strict thread matches above, loose matches on Subject: below --
2001-03-02 17:06 strange nonmonotonic behavior of gettimeoftheday Manfred Spraul
2001-03-02 22:33 John Being
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3A9FB734.6912206F@inet.com \
--to=eli.carter@inet.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olonho@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox