Skip to content

Implement task-safe platform-indepent timezones #10480

@klutzy

Description

@klutzy

Similar to #10463, extern::time::at() (which internally uses localtime()) currently depends on "TZ" environment variable, which causes setenv race.
Also its interpretation is also platform-dependent: linux libc understands TZ=America/Los_Angeles but Windows does not. (#10307)

We need:

  • Timezone type whose constructor may understand common time zone strings.
  • fn localtime(&self, utc_time) -> Tm method for Timezone. (This seems quite hard because it seems that there is no corresponding libc function)
  • For environment timezone, we may provide unsafe fn get_env_tz() -> Timezone.

I think this overlaps datetime design a bit, but anyway current implementation is "unsafe".

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