forked from enlightenment/efl
efl_net_dialer_http: fix build on windows.
Windows time_t is not a long, but long-long, then stick with int64_t so it works everywhere (converts to time_t internally). And there is no gmtime_r(), then use the gmtime() if not detected.
This commit is contained in:
parent
e5b3d43c4f
commit
345bba3ef1
|
@ -669,6 +669,7 @@ strlcpy \
|
|||
geteuid \
|
||||
getuid \
|
||||
pause \
|
||||
gmtime_r \
|
||||
])
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
|
|
|
@ -2347,7 +2347,7 @@ _efl_net_dialer_http_ssl_certificate_revogation_list_get(Eo *o EINA_UNUSED, Efl_
|
|||
return pd->ssl.crl;
|
||||
}
|
||||
|
||||
EOLIAN static long
|
||||
EOLIAN static int64_t
|
||||
_efl_net_dialer_http_date_parse(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED, const char *str)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(str, 0);
|
||||
|
@ -2355,14 +2355,20 @@ _efl_net_dialer_http_date_parse(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED
|
|||
}
|
||||
|
||||
EOLIAN static char *
|
||||
_efl_net_dialer_http_date_serialize(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED, long t)
|
||||
_efl_net_dialer_http_date_serialize(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED, int64_t ts)
|
||||
{
|
||||
static const char *const wkday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
static const char * const month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
char buf[128];
|
||||
struct tm *tm, storage;
|
||||
|
||||
time_t t = ts;
|
||||
struct tm *tm;
|
||||
#ifdef HAVE_GMTIME_R
|
||||
struct tm storage;
|
||||
tm = gmtime_r(&t, &storage);
|
||||
#else
|
||||
tm = gmtime(&t);
|
||||
#endif
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tm, NULL);
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
|
|
|
@ -372,7 +372,7 @@ class Efl.Net.Dialer.Http (Efl.Loop_User, Efl.Net.Dialer, Efl.Io.Sizer) {
|
|||
params {
|
||||
str: string; [[String in HTTP text format: Tue, 15 Nov 1994 12:45:26 GMT]]
|
||||
}
|
||||
return: long; [[Seconds since 1/1/1970]]
|
||||
return: int64; [[Seconds since 1/1/1970]]
|
||||
}
|
||||
|
||||
date_serialize @class {
|
||||
|
@ -381,7 +381,7 @@ class Efl.Net.Dialer.Http (Efl.Loop_User, Efl.Net.Dialer, Efl.Io.Sizer) {
|
|||
The timezone must be GMT (ie: gmtime()).
|
||||
]]
|
||||
params {
|
||||
epochtime: long; [[UNIX Epoch time - seconds since 1/1/1970]]
|
||||
epochtime: int64; [[UNIX Epoch time - seconds since 1/1/1970]]
|
||||
}
|
||||
return: free(own(ptr(char)), free) @warn_unused; [[Newly allocated null-terminated string on success or NULL on errors]]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue