[pisa-src] Re: r2137 - in trunk: Makefile.am libpisa/scheduler.c libpisa/scheduler.h libpisa/sysdep.c libpisa/sysdep.h libpisa/util.c libpisa/util.h

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Sun, 21 Mar 2010 12:39:05 +0100

On Sat, Mar 13, 2010 at 07:35:43PM +0100, Mircea Gherzan wrote:
> 
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ trunk/libpisa/sysdep.c    Sat Mar 13 19:35:42 2010        (r2137)
> @@ -0,0 +1,51 @@
> +int clock_gettime(int clock_id, struct timespec *ts)
> +{
> +    struct timeval tv;
> +    int err;
> +
> +    /* only the "realtime" clock is supported */
> +    if (clock_id != CLOCK_REALTIME) {
> +        errno = EINVAL;

errno is never declared.

> +    /* well... we can live with a lower time resolution, right? */
> +    err = gettimeofday(&tv, NULL);
> +    if (err) {
> +        return err;
> +    }
> +
> +    ts.tv_sec  = tv.tv_sec;
> +    ts.tv_nsec = tv.tv_usec * 1000;

./libpisa/sysdep.h:52: error: request for member ‘tv_sec’ in something not a 
structure or union
./libpisa/sysdep.h:53: error: request for member ‘tv_nsec’ in something not a 
structure or union

I strongly suspect this code was never tested...

Diego

Other related posts: