[RTEMS Project] #2697: Function for getting a time_t from a struct tm in UTC (like timegm on Linux and BSD)
RTEMS trac
trac at rtems.org
Thu Apr 21 05:22:54 UTC 2016
#2697: Function for getting a time_t from a struct tm in UTC (like timegm on Linux
and BSD)
--------------------------------+-------------------
Reporter: Christian Mauderer | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Newlib | Version: 4.12
Severity: normal | Resolution:
Keywords: |
--------------------------------+-------------------
Comment (by Christian Mauderer):
It seems that the solution in the crypto library is a simplified one that
does not care for leap seconds or similar. To be honest, I had not found
this one. But I found three others in freebsd:
* A comprehensive implementation can be found in the tzcode area:
https://github.com/freebsd/freebsd/blob/master/contrib/tzcode/stdtime/localtime.c
This implementation uses the same functions for mktime and timegm.
* Another implementation in ldns uses the solution from the man page. But
that is not thread save:
https://github.com/freebsd/freebsd/blob/master/contrib/ldns/compat/timegm.c
* A third implementation is in the ntp area:
https://github.com/freebsd/freebsd/blob/master/contrib/ntp/libntp/mktime.c
As far as I can see, the one from tzcode is the one that handles the most
details. It might would make sense to use this implementation for mktime
as well as timegm
--
Ticket URL: <http://devel.rtems.org/ticket/2697#comment:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list