summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-time/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-06-03 14:01:52 +0900
committerGitHub <[email protected]>2020-06-03 14:01:52 +0900
commit8bca11a64ed14afd6b3fc44cda3669cd71a03e65 (patch)
treeab6fd1f2e8455e9aefbbd7933aefbbdd70ce256a /mrbgems/mruby-time/src
parent14e325e45d336b06cd96e68843d0bb886aea1b22 (diff)
parentad6c58972cefd5c0193b0693ceab83f5bc2e23fa (diff)
downloadmruby-8bca11a64ed14afd6b3fc44cda3669cd71a03e65.tar.gz
mruby-8bca11a64ed14afd6b3fc44cda3669cd71a03e65.zip
Merge pull request #4800 from shuujii/set-MRB_STR_ASCII-flag-to-some-stringize-methods
Set `MRB_STR_ASCII` flag to some stringize methods
Diffstat (limited to 'mrbgems/mruby-time/src')
-rw-r--r--mrbgems/mruby-time/src/time.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index 5cd4abe6d..e76e11649 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -13,6 +13,7 @@
#include <mruby/data.h>
#include <mruby/numeric.h>
#include <mruby/time.h>
+#include <mruby/string.h>
#ifdef MRB_DISABLE_STDIO
#include <string.h>
@@ -954,7 +955,9 @@ mrb_time_to_s(mrb_state *mrb, mrb_value self)
struct mrb_time *tm = time_get_ptr(mrb, self);
mrb_bool utc = tm->timezone == MRB_TIMEZONE_UTC;
size_t len = (utc ? time_to_s_utc : time_to_s_local)(mrb, tm, buf, sizeof(buf));
- return mrb_str_new(mrb, buf, len);
+ mrb_value str = mrb_str_new(mrb, buf, len);
+ RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
+ return str;
}
void