BUILD: lua: replace timegm() with my_timegm() to fix build on Solaris 10

Akhnin Nikita reported that Lua doesn't build on Solaris 10 because
the code uses timegm() to parse a date, which is not provided there.
The recommended way to implement timegm() is broken in the man page,
as it is based on a change of the TZ environment variable at run time
before calling the function (which is obviously not thread safe, and
terribly inefficient).

Here instead we rely on the new my_timegm() function, it should be
sufficient for all known use cases.
This commit is contained in:
Willy Tarreau 2017-07-19 19:08:48 +02:00
parent cb1949b8b3
commit abd9bb20b7

View File

@ -287,7 +287,7 @@ static int hlua_parse_date(lua_State *L, int (*fcn)(const char *, int, struct tm
* the timezone from the broken-down time, it must be fixed * the timezone from the broken-down time, it must be fixed
* after the conversion. * after the conversion.
*/ */
time = timegm(&tm); time = my_timegm(&tm);
if (time == -1) { if (time == -1) {
lua_pushnil(L); lua_pushnil(L);
return 1; return 1;