summaryrefslogtreecommitdiff
path: root/src/plugins/lua/weechat-lua-api.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-04-10 21:26:15 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-04-10 21:26:15 +0200
commit3467d6eb430d132ff94e04ad7485d8f705317099 (patch)
treebcf6a9684d2f08c41e50ec95963be55ddb53144a /src/plugins/lua/weechat-lua-api.c
parent9a969c41dbd938f598fd06f2dee8bbd3feafea57 (diff)
downloadweechat-3467d6eb430d132ff94e04ad7485d8f705317099.zip
scripts: return long integer instead of string in function infolist_time
Diffstat (limited to 'src/plugins/lua/weechat-lua-api.c')
-rw-r--r--src/plugins/lua/weechat-lua-api.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 1fb82b8cd..418fbf811 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -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)