[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] How to find the exact time, when the serial data arrived?

On Fri, Sep 17, 1999 at 10:14:28AM +0200, Wojciech Zabolotny wrote:
> Hi All!
> I'm writing an application requiring the exact knowledge of arrival time
> of serial data (resolution below 0.1 sec is desired).
> Is there any way to arrange it in the standard Linux kernel, or should I
> modify the serial driver? (Or even use the RT Linux?)

You can use gettimeofday, which returns the time in a struct:

       struct timeval {
               long tv_sec;        /* seconds */
               long tv_usec;  /* microseconds */

(see the man page)
I think the real resolution of this is 0.01 seconds.  If that is not
enough, there is high resolution timer device you can compile into the
kernel.  If you look for it in the kernel configuration (make xconfig or
equivalent) you should be able to find it.


 E.L. Meijer (tgakem@chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)

Reply to: