This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: Conversion of ticks into conventional time?
- To: "Boris V. Guzhov" <borg at int dot spb dot ru>
- Subject: Re: [ECOS] Conversion of ticks into conventional time?
- From: Jonathan Larmour <jlarmour at redhat dot co dot uk>
- Date: Wed, 17 May 2000 15:44:11 +0100
- CC: ecos-discuss at sourceware dot cygnus dot com
- Organization: Red Hat UK Ltd.
- References: <003d01bfc00a$cdeb9e80$7601a8c0@borg.int.spb.ru>
"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