APIdock / Ruby
/
method

gmt_offset

ruby latest stable - Class: Time
gmt_offset()
public

Returns the offset in seconds between the timezone of time and UTC.

t = Time .gm (2000,1,1,20,15,1) #=> 2000年01月01日 20:15:01 UTC
t.gmt_offset  #=> 0
l = t.getlocal  #=> 2000年01月01日 14:15:01 -0600
l.gmt_offset  #=> -21600
VALUE
rb_time_utc_offset(VALUE time)
{
 struct time_object *tobj;
 GetTimeval(time, tobj);
 if (TIME_UTC_P(tobj)) {
 return INT2FIX(0);
 }
 else {
 MAKE_TM(time, tobj);
 return tobj->vtm.utc_offset;
 }
}

AltStyle によって変換されたページ (->オリジナル) /