public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* timegm() and other time related functions
@ 2023-01-25 13:57 Sebastian Huber
  2023-01-25 14:23 ` R. Diez
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Huber @ 2023-01-25 13:57 UTC (permalink / raw)
  To: newlib

Hello,

while porting nats.c to RTEMS I noticed that Newlib doesn't provide a 
timegm() function. There a couple of related patches and discussions on 
the Newlib mailing list in the last years.

In order to add support for timegm() I would replace the Newlib time 
function implementation with the version of a more actively maintained 
platform, for example OpenBSD, FreeBSD or bionic. It seems that the 
upstream for the bionic code is OpenBSD. The OpenBSD and FreeBSD code 
diverged a bit, however, FreeBSD seems to integrate changes from OpenBSD 
occasionally. The FreeBSD looks to be closer to the original tzcode and 
uses the pthread API. I tend to use the FreeBSD code. Would that be 
acceptable?

Kind regards,
	Sebastian

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: timegm() and other time related functions
  2023-01-25 13:57 timegm() and other time related functions Sebastian Huber
@ 2023-01-25 14:23 ` R. Diez
  0 siblings, 0 replies; 2+ messages in thread
From: R. Diez @ 2023-01-25 14:23 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: newlib


> while porting nats.c to RTEMS I noticed that Newlib doesn't provide a timegm() function.
> There a couple of related patches and discussions on the Newlib mailing list in the last years.

I tried to contribute an implementation of timegm() to Newlib a while ago, but after the reactions I got in this mailing list, I ended up contributing it to Picolibc instead. Search for timegm here:

https://github.com/picolibc/picolibc/blob/main/newlib/libc/time/mktime.c

This is the first commit:

https://github.com/picolibc/picolibc/commit/1a697a5228a04461066b851dfd96b1ddbbd603fa

And this commit adds the documentation for timegm:

https://github.com/picolibc/picolibc/commit/64d77e6dfefc4cdd40fda477d1d25f7a98d09c16

The affected files may have changed since them, so I would check the latest versions anyway.

I also contributed some tests for timegm. By the way, is the Newlib test suite still broken?

The timegm implementation actually needed little new code, it was basically a small reorganisation of existing Newlib code.

Regards,
   R. Diez


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-25 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 13:57 timegm() and other time related functions Sebastian Huber
2023-01-25 14:23 ` R. Diez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).