On Mon, Nov 18, 2013 at 1:02 AM, Arnaud Charlet <char...@adacore.com> wrote: >> Actually there are two issues with your change: >> >> Using time_t for tv_nsec looks actually wrong, the definition on (my) >> linux is: >> >> struct timespec { >> __kernel_time_t tv_sec; /* seconds */ >> long tv_nsec; /* nanoseconds */ >> };
This is wrong for x32 where tv_nsec is long long, not long. There are a couple places where long should be long long for x32. Glibc gets them right properly: /* A time value that is accurate to the nearest microsecond but also has a range of years. */ struct timeval { __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ }; >> As you can see, the types for tv_sec and tv_nsec are different. >> >> So the change to timespec looks wrong to me. > > In addition concerning s-taprop-linux.adb, the definition of struct > timeval on linux is: > > /* A time value that is accurate to the nearest > microsecond but also has a range of years. */ > struct timeval > { > __time_t tv_sec; /* Seconds. */ > __suseconds_t tv_usec; /* Microseconds. */ > }; > > So again, we have another type (__suseconds_t), and NOT time_t or __time_t > so it's really wrong for tv_nsec to use time_t. > All for Linux architectures, __suseconds_t and __suseconds_t are the same as time_t, including x32. If not, we can't use array for timeval. -- H.J.