mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:26:38 +02:00
scripts: return long integer instead of string in function infolist_time
This commit is contained in:
@@ -4524,28 +4524,17 @@ API_FUNC(infolist_time)
|
||||
{
|
||||
const char *infolist, *variable;
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
char timebuffer[64], *result;
|
||||
|
||||
API_INIT_FUNC(1, "infolist_time", API_RETURN_EMPTY);
|
||||
API_INIT_FUNC(1, "infolist_time", API_RETURN_LONG(0));
|
||||
if (lua_gettop (L) < 2)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
API_WRONG_ARGS(API_RETURN_LONG(0));
|
||||
|
||||
infolist = lua_tostring (L, -2);
|
||||
variable = lua_tostring (L, -1);
|
||||
|
||||
timebuffer[0] = '\0';
|
||||
time = weechat_infolist_time (API_STR2PTR(infolist),
|
||||
variable);
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
{
|
||||
if (strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp) == 0)
|
||||
timebuffer[0] = '\0';
|
||||
}
|
||||
result = strdup (timebuffer);
|
||||
time = weechat_infolist_time (API_STR2PTR(infolist), variable);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
API_RETURN_LONG(time);
|
||||
}
|
||||
|
||||
API_FUNC(infolist_free)
|
||||
|
||||
Reference in New Issue
Block a user