Problem on converting a "timespec" struct to a number of ticks
e.coullien@faiveley.com
e.coullien@faiveley.com
Wed Sep 22 15:28:00 GMT 2004
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff.txt
Type: application/octet-stream
Size: 1749 bytes
Desc: Text - character set unknown
URL: <http://sourceware.org/pipermail/ecos-patches/attachments/20040922/31b978f5/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: InterScan_Disclaimer.txt
URL: <http://sourceware.org/pipermail/ecos-patches/attachments/20040922/31b978f5/attachment.txt>
More information about the Ecos-patches
mailing list