Open syuu1228 opened 10 years ago
On C program, OSv provides correct utc offset. For example:
#include <stdio.h> #include <time.h> void main(void) { time_t timer; struct tm *date; char str[256]; timer = time(NULL); date = localtime(&timer); strftime(str, 255, "%Y, %B, %d, %A %p%I:%M:%S %z", date); printf("%s\n", str); }
will output correct utc offset with TZ param:
$ ./scripts/run.py -e "--env=TZ=JST-9 /a.out" OSv v0.13-76-g1033d7e eth0: 192.168.122.15 2014, October, 22, Wednesday AM04:32:45 +0900
However, in Ruby Time class returns localtime with +0000 utc offset.
$ ./scripts/run.py -e "--env=TZ=JST-9 /ruby.so /irb" OSv v0.13-76-g1033d7e eth0: 192.168.122.15 sigaltstack() stubbed irb(main):001:0> __sigsetjmp() stubbed Time.now => 2014-10-22 04:34:07 +0000
It looks like implementing their original strftime, probably Ruby does not able to receive correct utc offset in the implementation.
@nyh Does this ring a bell to you?
On C program, OSv provides correct utc offset. For example:
will output correct utc offset with TZ param:
However, in Ruby Time class returns localtime with +0000 utc offset.
It looks like implementing their original strftime, probably Ruby does not able to receive correct utc offset in the implementation.