ts-7000
[Top] [All Lists]

Re: [ts-7000] Time printing

To:
Subject: Re: [ts-7000] Time printing
From: Jim Jackson <>
Date: Tue, 18 Mar 2008 12:47:21 +0000 (GMT)


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.



------------------------------------

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/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU