* time.c (time_succ): refactored to avoid gmt variable.
(strftimev): use TIME_UTC_P. (time_strftime): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
afbb1ba21b
commit
4c2e943091
@ -1,3 +1,9 @@
|
|||||||
|
Sat Apr 25 15:39:44 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* time.c (time_succ): refactored to avoid gmt variable.
|
||||||
|
(strftimev): use TIME_UTC_P.
|
||||||
|
(time_strftime): ditto.
|
||||||
|
|
||||||
Sat Apr 25 15:21:33 2009 Tanaka Akira <akr@fsij.org>
|
Sat Apr 25 15:21:33 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* time.c (TIME_UTC_P): new macro..
|
* time.c (TIME_UTC_P): new macro..
|
||||||
|
13
time.c
13
time.c
@ -2445,13 +2445,12 @@ static VALUE
|
|||||||
time_succ(VALUE time)
|
time_succ(VALUE time)
|
||||||
{
|
{
|
||||||
struct time_object *tobj;
|
struct time_object *tobj;
|
||||||
int gmt;
|
struct time_object *tobj2;
|
||||||
|
|
||||||
GetTimeval(time, tobj);
|
GetTimeval(time, tobj);
|
||||||
gmt = tobj->gmt;
|
|
||||||
time = time_new_timev(rb_cTime, add(tobj->timev, INT2FIX(1)));
|
time = time_new_timev(rb_cTime, add(tobj->timev, INT2FIX(1)));
|
||||||
GetTimeval(time, tobj);
|
GetTimeval(time, tobj2);
|
||||||
tobj->gmt = gmt;
|
tobj2->gmt = tobj->gmt;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2930,7 +2929,7 @@ strftimev(const char *fmt, VALUE time)
|
|||||||
|
|
||||||
GetTimeval(time, tobj);
|
GetTimeval(time, tobj);
|
||||||
MAKE_TM(time, tobj);
|
MAKE_TM(time, tobj);
|
||||||
len = rb_strftime_alloc(&buf, fmt, &tobj->vtm, tobj->timev, tobj->gmt);
|
len = rb_strftime_alloc(&buf, fmt, &tobj->vtm, tobj->timev, TIME_UTC_P(tobj));
|
||||||
str = rb_str_new(buf, len);
|
str = rb_str_new(buf, len);
|
||||||
if (buf != buffer) xfree(buf);
|
if (buf != buffer) xfree(buf);
|
||||||
return str;
|
return str;
|
||||||
@ -3013,7 +3012,7 @@ time_strftime(VALUE time, VALUE format)
|
|||||||
|
|
||||||
str = rb_str_new(0, 0);
|
str = rb_str_new(0, 0);
|
||||||
while (p < pe) {
|
while (p < pe) {
|
||||||
len = rb_strftime_alloc(&buf, p, &tobj->vtm, tobj->timev, tobj->gmt);
|
len = rb_strftime_alloc(&buf, p, &tobj->vtm, tobj->timev, TIME_UTC_P(tobj));
|
||||||
rb_str_cat(str, buf, len);
|
rb_str_cat(str, buf, len);
|
||||||
p += strlen(p);
|
p += strlen(p);
|
||||||
if (buf != buffer) {
|
if (buf != buffer) {
|
||||||
@ -3027,7 +3026,7 @@ time_strftime(VALUE time, VALUE format)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
len = rb_strftime_alloc(&buf, RSTRING_PTR(format),
|
len = rb_strftime_alloc(&buf, RSTRING_PTR(format),
|
||||||
&tobj->vtm, tobj->timev, tobj->gmt);
|
&tobj->vtm, tobj->timev, TIME_UTC_P(tobj));
|
||||||
}
|
}
|
||||||
str = rb_str_new(buf, len);
|
str = rb_str_new(buf, len);
|
||||||
if (buf != buffer) xfree(buf);
|
if (buf != buffer) xfree(buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user