This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Conversion of ticks into conventional time?


"Boris V. Guzhov" wrote:
> 
> How to convert kernel ticks into conventional time and back?
> 
> The "eCos reference manual" informs,  that for this
> purpose the library functions should be used (page 6).
> 
> I shall be grateful for any help about these functions.

If you look at the documention at
http://sourceware.cygnus.com/ecos/docs-1.3.1/ref/ecos-ref.9.html#pgfId=1023895
(which is also supplied in HTML with eCos itself), the function to use for
this is cyg_clock_get_resolution(). This returns something of type
cyg_resolution_t, described in
http://sourceware.cygnus.com/ecos/docs-1.3.1/ref/ecos-ref.9.html#29032

"A cyg_resolution_t stores the resolution of a clock. The resolution is
defined to be (dividend/divisor) nanoseconds per tick. 

typedef struct {
    cyg_uint32 dividend;
    cyg_uint32 divisor;
} cyg_resolution_t;

For the system real-time-clock you would get the resolution with

 cyg_clock_get_resolution( cyg_real_time_clock() );

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]