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;
VALUE zone;
GetTimeval(time, tobj);
MAKE_TM(time, tobj);
if (TZMODE_UTC_P(tobj)) {
return rb_usascii_str_new_cstr("UTC");
}
zone = tobj->vtm.zone;
if (NIL_P(zone))
return Qnil;
if (RB_TYPE_P(zone, T_STRING))
zone = rb_str_dup(zone);
return zone;
}