This is the mail archive of the ecos-discuss@sourceware.org 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]

Re: ecos and gettimeofday()


On Wed, Oct 12, 2005 at 08:12:01PM +0200, Alexander Neundorf wrote:
> Hi,
> 
> attached you can find two patches which add gettimeofday(). This patch is not 
> intended to be commited as is, it's just a first attempt, in order to get 
> some comments how to do it right.
> 
> It does the following:
> it adds a very simple sys/time.h to the isoinfra/ package, with the contents 
> more or less according to 
> http://www.opengroup.org/onlinepubs/000095399/toc.htm.
> A simple version of gettimeofday() is included in the header as inline 
> function.
> 
> Additionally it adds the sys/time.h which currently lives in the tcp/ip 
> package to the compat/posix/ package, which overrides the contents of 
> isoinfra/include/sys/time.h.
> 
> What do you think about this approach ?
> 
> If it is ok, I'll prepare a complete patch.
> If you think a gettimeofday() implementation doesn't belong in a header in 
> isoinfra/ (I guess that will be the case), please suggest a better approach.
> 
> If gettimeofday() would be implemented only in the posix package, then e.g. 
> the freebsd tcp/ip stack would require the posix compat. package. I don't 
> think this would be a good idea, adding the dependency to posix just for a 
> single tiny function.
> Where would be a better place for gettimeofday(), maybe 
> language/c/libc/time/ ? Please let me know.

Jifl message made is clear that the implementation does not belong in
the header file. libc is the wrong as well. The correct place would be
posix since this is a posix function. It might be possible to persuade
me it could go in a package of its own, but i'm not sure about that.

Also your implementation is not so great. Look at Nick's in the ppp
code. Nick's is less arithmetic and less likely to cause an overflow.

Also think about the case when the kernel is not included. Files in
isoinfra should not blindly include kernel header files.

        Andrew


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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