Skip to content

Time objects at UTC local zone should not be utc? #9436

Open

Description

@headius

When no time zone is specified but the local timezone is UTC, the utc? and gmt? flags for Time should return false.

UTC in this situation is considered to be a local time zone and it appears that the utc? bit is intended to indicate that a Time object has been specified as UTC directly.

This leads to several failures, discovered during #9419:

Time#_dump preserves the GMT flag
Time#_dump dumps like MRI's marshaled time format
Time.at passed Numeric returns a non-UTC Time
Time.at passed Time returns a non-UTC time if the argument is non-UTC
Time#dup returns an independent Time object
Time#gmt? returns true if time represents a time in UTC (GMT)
Time#localtime on a frozen time raises a FrozenError if the time has a different time zone
Time#- returns a non-UTC time if self is non-UTC
Time#+ returns a non-UTC time if self is non-UTC
Time#utc? returns true only if time represents a time in UTC (GMT)

I won't tag these specs, but for the FreeBSD and OpenBSD jobs from #9419 I will force TZ to be America/Chicago for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions