diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-04-10 21:26:15 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-04-10 21:26:15 +0200 |
commit | 3467d6eb430d132ff94e04ad7485d8f705317099 (patch) | |
tree | bcf6a9684d2f08c41e50ec95963be55ddb53144a /src/plugins/ruby | |
parent | 9a969c41dbd938f598fd06f2dee8bbd3feafea57 (diff) | |
download | weechat-3467d6eb430d132ff94e04ad7485d8f705317099.zip |
scripts: return long integer instead of string in function infolist_time
Diffstat (limited to 'src/plugins/ruby')
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index eec272e6f..f440c599c 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -5403,14 +5403,12 @@ weechat_ruby_api_infolist_pointer (VALUE class, VALUE infolist, VALUE variable) static VALUE weechat_ruby_api_infolist_time (VALUE class, VALUE infolist, VALUE variable) { - char *c_infolist, *c_variable, timebuffer[64], *result; + char *c_infolist, *c_variable; time_t time; - struct tm *date_tmp; - VALUE return_value; - API_INIT_FUNC(1, "infolist_time", API_RETURN_EMPTY); + API_INIT_FUNC(1, "infolist_time", API_RETURN_LONG(0)); if (NIL_P (infolist) || NIL_P (variable)) - API_WRONG_ARGS(API_RETURN_EMPTY); + API_WRONG_ARGS(API_RETURN_LONG(0)); Check_Type (infolist, T_STRING); Check_Type (variable, T_STRING); @@ -5418,17 +5416,9 @@ weechat_ruby_api_infolist_time (VALUE class, VALUE infolist, VALUE variable) c_infolist = StringValuePtr (infolist); c_variable = StringValuePtr (variable); - timebuffer[0] = '\0'; time = weechat_infolist_time (API_STR2PTR(c_infolist), c_variable); - date_tmp = localtime (&time); - if (date_tmp) - { - if (strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp) == 0) - timebuffer[0] = '\0'; - } - result = strdup (timebuffer); - API_RETURN_STRING_FREE(result); + API_RETURN_LONG(time); } static VALUE |