zone()
public
Returns the name of the time zone used for
time. As of Ruby 1.8, returns
“UTC” rather than “GMT” for UTC times.
t = Time.gm(2000, "jan", 1, 20, 15, 1)
t.zone
t = Time.local(2000, "jan", 1, 20, 15, 1)
t.zone
Show source
static VALUE
time_zone(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
MAKE_TM(time, tobj);
if (TIME_UTC_P(tobj)) {
return rb_usascii_str_new_cstr("UTC");
}
if (tobj->vtm.zone == NULL)
return Qnil;
return time_zone_name(tobj->vtm.zone);
}