Method: Time#utc?
- Defined in:
- time.c
#utc? ⇒ Boolean
Returns true
if self
represents a time in UTC (GMT):
now = Time.now
# => 2022-08-18 10:24:13.5398485 -0500
now.utc? # => false
now.getutc.utc? # => true
utc = Time.utc(2000, 1, 1, 20, 15, 1)
# => 2000-01-01 20:15:01 UTC
utc.utc? # => true
Time
objects created with these methods are considered to be in UTC:
-
Time.utc
-
Time#utc
-
Time#getutc
Objects created in other ways will not be treated as UTC even if the environment variable “TZ” is “UTC”.
Related: Time.utc.
4028 4029 4030 4031 4032 4033 4034 4035 |
# File 'time.c', line 4028
static VALUE
time_utc_p(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
return RBOOL(TZMODE_UTC_P(tobj));
}
|