Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
a8001d69
Unverified
Commit
a8001d69
authored
Jul 29, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Jul 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4604 from kou/time-to-s-utf8
Fix Time#to_s encoding on Windows
parents
ff43b2b9
effae4ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
mrbgems/mruby-time/src/time.c
mrbgems/mruby-time/src/time.c
+9
-1
No files found.
mrbgems/mruby-time/src/time.c
View file @
a8001d69
...
...
@@ -19,6 +19,8 @@
#include <string.h>
#endif
#include <stdlib.h>
#define NDIV(x,y) (-(-((x)+1)/(y))-1)
#define TO_S_FMT "%Y-%m-%d %H:%M:%S "
...
...
@@ -931,7 +933,13 @@ mrb_time_to_s(mrb_state *mrb, mrb_value self)
struct
mrb_time
*
tm
=
time_get_ptr
(
mrb
,
self
);
const
char
*
fmt
=
tm
->
timezone
==
MRB_TIMEZONE_UTC
?
TO_S_FMT
"UTC"
:
TO_S_FMT
"%z"
;
size_t
len
=
strftime
(
buf
,
sizeof
(
buf
),
fmt
,
&
tm
->
datetime
);
return
mrb_str_new
(
mrb
,
buf
,
len
);
char
*
utf8
;
mrb_value
mrb_string
;
buf
[
len
]
=
'\0'
;
utf8
=
mrb_utf8_from_locale
(
buf
,
(
int
)
len
);
mrb_string
=
mrb_str_new_cstr
(
mrb
,
utf8
);
mrb_utf8_free
(
utf8
);
return
mrb_string
;
}
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment