mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Fionn Behrens <fionn@unix-ag.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: System time warping around real time problem - please help
Date: Tue, 25 Mar 2003 12:07:52 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.53.0303251152080.29361@chaos> (raw)
In-Reply-To: <1048609931.1601.49.camel@rtfm>

On Tue, 25 Mar 2003, Fionn Behrens wrote:

>
> Hello all,
>
>
> I have got an increasingly annoying problem with our fairly new (fall
> '02) Dual Athlon2k+ Gigabyte 7dpxdw linux system running 2.4.20.
> The only kernel patch applied is Alan Cox's ptrace patch.
>

I am using the exact same kernel (a lot of folks are). There
is no such jumping on my system.
Try this program:

#include <stdio.h>
#include <time.h>
int main() {
   time_t x,y;
   (void)time(&x);
   (void)time(&y);
   for(;;) {
       (void)time(&x);
       if(x < y)
           printf("Prev %ld New %ld\n", y, x);
       y = x;
   }
   return 0;
}
If this shows time jumping around you have one of either:

(1)	Bad timer channel 0 chip (PIT).
(2)	Some daemon trying to sync time with another system.
(3)	You are traveling too close to the speed of light.

Now, your script shows time in fractional seconds.

> 1048608745.61 > 1048608745.60

You can modify the program to do this:


#include <stdio.h>
#include <sys/time.h>
int main() {
   struct timeval tv;
   double x, y;
   (void)gettimeofday(&tv, NULL);
   x = (double) tv.tv_sec * 1e6;
   x += (double) tv.tv_usec;
   y = x;
   for(;;) {
       (void)gettimeofday(&tv, NULL);
       x = (double) tv.tv_sec * 1e6;
       x += (double) tv.tv_usec;
       if(x < y)
           printf("Prev %f New %f\n", y, x);
       y = x;
   }
   return 0;
}

There should be no jumping around -- and there isn't on
any system I've tested this on.

> Software crashes are regularly - naturally. No programmer expects system
> timers going back in time.
>

Hmmm, software should never crash. Even if the timers jump backwards
as you say, they should eventually time-out. If you have crashes, this
may point to other hardware problems as well.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.


  reply	other threads:[~2003-03-25 16:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-25 16:32 Fionn Behrens
2003-03-25 17:07 ` Richard B. Johnson [this message]
2003-03-25 17:17   ` Tim Schmielau
2003-03-25 18:12   ` Fionn Behrens
2003-03-25 18:29     ` Richard B. Johnson
2003-03-25 21:16   ` Fionn Behrens
2003-03-25 22:14     ` george anzinger
2003-03-25 22:55       ` Fionn Behrens
2003-03-26  0:13         ` Alan Cox
2003-03-26  2:28           ` george anzinger
2003-03-26 14:38             ` Alan Cox
2003-03-26 16:12               ` george anzinger
2003-03-26 17:06                 ` Richard B. Johnson
2003-03-26 18:12                   ` george anzinger
2003-03-26  3:11           ` Chris Friesen
2003-03-26 14:35             ` Alan Cox
2003-03-26 10:48           ` Fionn Behrens
     [not found] <20030325164014$031c@gated-at.bofh.it>
2003-03-26  9:31 ` Kay Diederichs
2003-04-03 13:22 Fionn Behrens

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=Pine.LNX.4.53.0303251152080.29361@chaos \
    --to=root@chaos.analogic.com \
    --cc=fionn@unix-ag.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®