localtime()
public
Show source
static VALUE
time_localtime(VALUE time)
{
struct time_object *tobj;
struct tm *tm_tmp;
time_t t;
IF_HAVE_GMTIME_R(struct tm result);
GetTimeval(time, tobj);
if (!tobj->gmt) {
if (tobj->tm_got)
return time;
}
else {
time_modify(time);
}
t = tobj->ts.tv_sec;
tm_tmp = LOCALTIME(&t, result);
if (!tm_tmp)
rb_raise(rb_eArgError, "localtime error");
tobj->tm = *tm_tmp;
tobj->tm_got = 1;
tobj->gmt = 0;
return time;
}