diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-05-14 22:05:45 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-05-14 22:50:36 +0900 |
| commit | edf4b33c61d04148ef11406d37256feda5fe78fb (patch) | |
| tree | 467356b689e5744116bc54de7ef9e7e6a306fe00 /src/error.c | |
| parent | d8eff635fd70360eb83849fa2a19413b1ffeaaeb (diff) | |
| download | mruby-edf4b33c61d04148ef11406d37256feda5fe78fb.tar.gz mruby-edf4b33c61d04148ef11406d37256feda5fe78fb.zip | |
Refine `Time#(to_s|inspect)`
For the following reasons:
- Ruby compatibility.
- Add UTC offset (time zone informations was not included by #4433).
- More readable.
Example:
Before this patch:
p Time.gm(2003,4,5,6,7,8,9) #=> Sat Apr 5 06:07:08 2003
p Time.local(2013,10,28,16,27,48) #=> Mon Oct 28 16:27:48 2013
After this patch:
p Time.gm(2003,4,5,6,7,8,9) #=> 2003-04-05 06:07:08 UTC
p Time.local(2013,10,28,16,27,48) #=> 2013-10-28 16:27:48 +0900
Implementation:
I use `strftime(3)` because UTC offset can be added and program size become
smaller than the other implementations (using `sprintf(3)`, self conversion
etc) in my environment.
Diffstat (limited to 'src/error.c')
0 files changed, 0 insertions, 0 deletions
