Skip to content

TimeZone.SYSTEM encourages static dependency #17

Open
@JakeWharton

Description

@JakeWharton

Following on from the Instant.now() static dependency on the system clock, TimeZone.SYSTEM has a similar static dependency on the system.

Would it make sense to put this as an instance member on Clock as well? That's how (one of) our clock abstractions exposes it.

Without this you'll have the ability to control time in places like tests. Anyone calling into TimeZone.SYSTEM and combining it with an instant from a fake clock will produce a time in the hosts zone rather than a stable zone likely producing flaky tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis could break existing codetimezoneThe model and API of timezones

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions