Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Proposed clocks improvements #71

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Commits on Jul 10, 2024

  1. Rename "instant" to "monotonic-clock-point"

    Other possibilities: "monotonic-time", "clock-point" (if the
    "monotonic-clock" namespace is sufficient and we don't need to repeat
    'monotonic'), "timestamp".
    
    Also renames monotonic-clock::subscribe-instant to subscribe-clock-point.
    
    Other possibilities: "subscribe-monotonic-clock-point", "subscribe-time",
    "subscribe-monotonic-time", "subscribe-timestamp".
    ptomato committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    8c12295 View commit details
    Browse the repository at this point in the history
  2. Rename "wall-clock" to "system-clock"

    Other possibilities: "system-time", "exact-clock", "exact-time",
    "current-time", etc.
    
    I propose "system-clock" because referring to it as a clock makes sense,
    within the WASI Clocks interface.
    ptomato committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    e4521a3 View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2024

  1. Rename "datetime" to "instant"

    Other possibilities: "system-clock-point", "clock-point" (analogous to
    "monotonic-clock-point"), "exact-time", "absolute-time", "timestamp",
    "epoch-time".
    ptomato committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    13f62d1 View commit details
    Browse the repository at this point in the history
  2. Remove "in-daylight-saving-time" flag

    This flag is problematic because when a time zone is "in DST" is not well
    defined. Most time zones in the world don't use DST at all. Of the ones
    that do, most go to DST during the summer for half the year, but not all.
    
    For example, the function in Moment.js that provides this functionality
    comes with a giant caveat:
    https://momentjs.com/docs/#/query/is-daylight-saving-time/
    ptomato committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    3921fca View commit details
    Browse the repository at this point in the history
  3. Rename "timezone-display::name" to "id"

    Other possibilities: "tzid", "iana-id", "identifier", "iana-identifier".
    
    Returning a user-displayable name as part of timezone-display would
    require more information: the user's preferred language, and the preferred
    style for the name:
     - abbreviated or not
     - year-round or specific to the Instant
    E.g., the time zone with the IANA id "America/Los_Angeles" might be
    displayed as "Pacific Time", "Pacific Standard Time", "Pacific Daylight
    Time", "PT", "PST", "PDT", "Nordamerikanische Westküstenzeit"...
    
    The Rust iana_time_zone crate uses IANA time zone IDs, so if this
    interface needs to be able to implement iana_time_zone, timezone-display
    should have an IANA ID and not a user-displayable name.
    ptomato committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    0ced9d5 View commit details
    Browse the repository at this point in the history
  4. Measure UTC offset in nanoseconds

    There are time zones that used sub-minute or even sub-second UTC offsets
    for instants in the past. E.g., when built using Vanguard format, the UTC
    offset in the TZDB for "Asia/Ho_Chi_Minh" before July 1906 is
    7:06:30.133333333.
    ptomato committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    b21c4a5 View commit details
    Browse the repository at this point in the history
  5. Refactor timezone-display into separate methods

    If the timezone-display ID is an IANA ID, and we are going with the
    approach of not making the localized ("PST" vs "PDT" vs "PT") name part of
    this component, then the current time zone doesn't depend on the current
    time.
    
    After removing the isDST flag, timezone-display contains two pieces of
    data, the ID and the UTC offset. The UTC offset is already available via
    a function that takes an Instant as input. The ID could just be available
    via its own function that doesn't take any input.
    
    In that case there would be no need for timezone-display.
    ptomato committed Jul 11, 2024
    Configuration menu
    Copy the full SHA
    205bdc8 View commit details
    Browse the repository at this point in the history