--- In Jim Jackson <> wrote:
>
>
>
>
> On Tue, 18 Mar 2008, marcolamonato wrote:
>
> > Hi,
> >
> > I've got a TS-7250 with RTC installed
> >
> > 1) can I print the machine clock time with the micro-second
> > resolution?
> >
> > 2) how?
> >
> > So far, I've only been able to have a 10-usec resolution, with the
> > following C code:
> >
> > /* Variables */
> > time_t actual_date;
> > struct tm *actual_time_tm;
> > struct timeval tp;
> > long milli;
> >
> > /* Time Print */
> > actual_date = time(NULL);
> > actual_time_tm = gmtime(&actual_date);
> > gettimeofday(&tp,(struct timezone *)NULL);
> > milli=tp.tv_usec/1000;/* For 3 digit resolution */
> > printf("\nTime: %02d:%02d:%02d.%03d\n", actual_time_tm->tm_hour,
> > actual_time_tm->tm_min, actual_time_tm->tm_sec, milli);
> >
> >
> > This prints out something like:
> > "Time: 09:06:05.770"
> > "Time: 09:06:05.780"
> > "Time: 09:06:05.850"
> >
>
> I think you mean 10millisec resolution!
>
> Actually you are not printing out the time form the RTC.
>
> On boot the linux kernel reads the RTC, or queries an NTP server,
or uses
> rdate or similar, to set the system time. By arranging the hardware
to give a
> tick and with quite a complicated tick adjust system, the kernel
keeps time
> while running.
>
> The "tick" is traditionally, 2.4 kernel, configured when the kenrel
is
> compiled to 100Hz. You can rebuild a kernel with a more accurate
tick,
> but it up the kernel load - the tick is used by the kernel for
scheduling etc.
>
> There is a spare timer counter on the 9302 that's available for
use - you'd
> have to write a kernel driver for it. There is an example kernel
driver by
> Phillip McCarley, that uses the timer/counter to do faster sampling
with the
> MAX197 ADC. It is in the file area of the group. Look for ADC
kernel driver.
>
Jim,
yes, you're right, milliseconds, sorry!
I'll have a look at the file you suggested, thanks for your valuable
help!
Marco
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|