[PATCH v2 09/11] Use clock_gettime to implement gettimeofday.
Lukasz Majewski
lukma@denx.de
Tue Oct 29 09:08:00 GMT 2019
Hi Joseph,
> On Mon, 28 Oct 2019, Lukasz Majewski wrote:
>
> > > attribute_compat_text_section
> > > __gettimeofday_tv32 (struct timeval32 *restrict tv32, void
> > > *restrict tz) {
> > > - struct timeval tv;
> > > - __gettimeofday (&tv, tz);
> > > + if (__glibc_unlikely (tz != 0))
> > > + memset (tz, 0, sizeof (struct timezone));
> > >
> > > - tv64_to_tv32 (tv32, &tv);
> > > + struct timespec ts;
> > > + __clock_gettime (CLOCK_REALTIME, &ts);
> > > +
> > > + ts64_to_tv32 (tv32, &ts);
> >
> > IMHO, this shall be replaced with valid_* functions from
> > include/time.h
>
> This is dealing with an alpha-specific timeval32 structure;
Maybe I did not noticed it earlier.
The tv32-compat.h defines [1]:
struct timeval32
{
int32_t tv_sec;
int32_t tv_usec;
};
and conversion functions - like ts64_to_tv32() are to handle this
specific type.
I do think that if struct timeval32 is alpha specific, then the
conversion functions shall be kept.
> I don't
> see how the functions in include/time.h are applicable.
>
Ok.
Note:
[1] - https://patchwork.ozlabs.org/patch/1184084/
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20191029/c8ded4d6/attachment.sig>
More information about the Libc-alpha
mailing list