/* * call-seq: * time.localtime => time * * Converts <i>time</i> to local time (using the local time zone in * effect for this process) modifying the receiver. * * t = Time.gm(2000, "jan", 1, 20, 15, 1) * t.gmt? #=> true * t.localtime #=> Sat Jan 01 14:15:01 CST 2000 * t.gmt? #=> false */ static VALUE time_localtime(time) VALUE time; { struct time_object *tobj; struct tm *tm_tmp; time_t t; GetTimeval(time, tobj); if (!tobj->gmt) { if (tobj->tm_got) return time; } else { time_modify(time); } t = tobj->tv.tv_sec; tm_tmp = localtime(&t); if (!tm_tmp) rb_raise(rb_eArgError, "localtime error"); tobj->tm = *tm_tmp; tobj->tm_got = 1; tobj->gmt = 0; return time; }