This is the mail archive of the ecos-patches@sources.redhat.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]
Other format: [Raw text]

Problem on converting a "timespec" struct to a number of ticks



Function "cyg_timespec_to_ticks()" belongs to "time.cxx", part of POSIX
compatibility package. This function converts a "timespec" struct to a number of
ticks. The "timespec" struct is used to express a duration or a delay in
nanoseconds.

When testing POSIX compatibility package, the following behavior can be observed
: 15.000.001 nanosecondes are converted to 3 system ticks (the system tick is
set to 10 ms). The result should be 2 ticks (20 ms),

We want to achieve better accuracy of this function. As it is called by
"nanosleep()", the accuracy of our delays relies on "cyg_timespec_to_ticks()".

The behavior we expect from "cyg_timespec_to_ticks()" is described by the table
below :

nanoseconds         ticks
19.999.999             2
20.000.000             2
20.000.001             3
29.999.999             3
30.000.000             3

The roundup is always made to the next integer value. When the number of
nanoseconds is an exact number of ticks, no roundup is necessary.

Up to now, "cyg_timespec_to_ticks()" calls the "convert()" function (file
"clock.inl", "kernel" package). Now, this (complicated) function is no more used
at all.


(See attached file: diff.txt)

Attachment: diff.txt
Description: Text - character set unknown

Attachment: InterScan_Disclaimer.txt
Description: Text document


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