[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
Tue Apr 19 09:46:52 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 | Keywords:
--------------------------------+------------------
It seems that there is no thread save possibility to convert a `struct tm`
that holds a UTC time into a `time_t` (the inverse of the POSIX `gmtime()`
function). `mktime` does this for the current locale only.
Linux and BSD provide a non-POSIX-function called `timegm()` (see
http://linux.die.net/man/3/timegm). According to the man page, the use of
this functions should be avoided. The linked man page provides a solution
that only uses POSIX functions. But that solution is not thread save.
We should think about adding `timegm()` to newlib for compatibility with
applications that use it (e.g. the civetweb web server).
--
Ticket URL: <http://devel.rtems.org/ticket/2697>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list