Skip to content

Move fs::Metadata::modified to modified_as_ms and reserve for the real Datetime type #846

Closed
@m13253

Description

@m13253

As is documented here: std::fs::Metadata::modified, method modifed returns the modification time in milliseconds since the epoch.

We don't yet have a Datetime yet. We even haven't decided which epoch to use at the moment! But we will surely have one some time in the future.

I suggest we move modified to modified_as_ms and reserve for the real Datetime type.

My reasons:

  1. If we don't do that, inconsistency will be introduced when the real Datetime type is invented.
  2. Some filesystems (e.g. ext4) provide modification time in a nanosecond accuracy (10-9s). Milliseconds are far not enough, a single u64 is far not enough.
  3. Reserving in advance will reduce the pain at the transition. Instead of making old codes fail to compile, we can issue a "deprecated" warning then, to let the programmer switch to the final real modified.

Related PR #739

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