Method: Time#gmtoff
- Defined in:
- time.c
#utc_offset ⇒ Integer
Returns the offset in seconds between the timezones of UTC and self:
Time.utc(2000, 1, 1).utc_offset # => 0
Time.local(2000, 1, 1).utc_offset # => -21600 # -6*3600, or minus six hours.
5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 |
# File 'time.c', line 5062
VALUE
rb_time_utc_offset(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
if (TZMODE_UTC_P(tobj)) {
return INT2FIX(0);
}
else {
MAKE_TM(time, tobj);
return tobj->vtm.utc_offset;
}
}
|