[PATCH 00/04] fix SPU time

Patrick Mansfield patmans@us.ibm.com
Wed Feb 14 22:37:00 GMT 2007

The removal of the "#ifdef HAVE_GETTIMEOFDAY" in newlib/libc/time/time.c
means libc versions will be normally be used rather than any libgloss
versions, and requires a gettimeofday(). 

In addition, since _gettimeofday_r() is in newlib/libc/reent/timer.c along
with times() (with an 's'), in order to link, newlib now requires both a
gettimeofday() and times() to be implemented in order to use time() or

This breaks spu time() - though the spu code was added after the removal of
the ifdef - and I think some other archs are broken (by code inspection,
like mips). If other archs are broken, it might be a good idea to revert
that change (and the configure.host changes).

This patchset fixes time() so it works again for spu, mainly by adding the
spu gettimeofday().

I built and tested time() and gettimeofday() for SPU with all these
patches applied. I didn't make doc, I'm not sure how that is done or if my
changes work with it.

patch 1: split gettimeofday_r and times_r out of reent/timer.c into their
own files, mainly so we only get link failures (on spu) when times() is
directly called.

patch 2: add spu gettimeofday (offload call)

patch 3: remove spu time, since it is no longer called (side note: we have
to leave the offload support in libspe / libspe2 of time for backwards
compatability, we should have always supported time() via usage of

patch 4: newlib and libgloss ChangeLog

-- Patrick Mansfield

More information about the Newlib mailing list