Document number: P1982R0


Howard E. Hinnant
2019-11-09

Rename link to time_zone_link

Addresses DE 346

Contents

Introduction

The LEWG in Belfast requested that I write a paper which provides wording for DE 346 as modified by the discussion in LEWG. The LEWG chose the name time_zone_link as a replacement for link, and specifically chose not to change the associated data member of tzdb links.

Wording

  1. Modify the synopsis in [time.syn] as indicated:

    ...
    // 27.11.9, class time_zone_link
    class time_zone_link;
    
    bool operator==(const time_zone_link& x, const time_zone_link& y);
    strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y);
    ...
    
  2. Modify the synopsis in [time.zone.db.tzdb] as indicated:

    namespace std::chrono {
      struct tzdb {
        string                 version;
        vector<time_zone>      zones;
        vector<time_zone_link> links;
        vector<leap>           leaps;
    
        const time_zone* locate_zone(string_view tz_name) const;
        const time_zone* current_zone() const;
      };
    }
    
  3. Modify [time.zone.db.tzdb]/p2 as indicated:

    const time_zone* locate_zone(string_view tz_name) const;
    

    2 Returns: If a time_zone is found for which name() == tz_name, returns a pointer to that time_zone. Otherwise if a link is found for which tz_name == link.name(), then a pointer is returned to the time_zone for which zone.name() == link.target().

    • If a time_zone, tz, is found for which tz.name() == tz_name, a pointer to tz;

    • otherwise, if a time_zone_link, tz_l, is found for which tz_l.name() == tz_name, then a pointer to the time_zone, tz, for which tz.name() == tz_l.target().

    [Note: A time_zone_link specifies an alternative name for a time_zone. — end note]

  4. Modify the title of [time.zone.link] as indicated:

    Class time_zone_link

  5. Modify [time.zone.link.overview] as indicated:

    namespace std::chrono {
      class time_zone_link {
      public:
        time_zone_link(time_zone_link&&) = default;
        time_zone_link& operator=(time_zone_link&&) = default;
    
        // unspecified additional constructors
    
        string_view name()   const noexcept;
        string_view target() const noexcept;
      };
    }
    

    1 A time_zone_link specifies an alternative name for a time_zone. time_zone_links are constructed when the time zone database is initialized.

  6. Modify [time.zone.link.members]/p2 as indicated:

    string_view target() const noexcept;
    

    2 Returns: The name of the time_zone for which this time_zone_link provides an alternative name.

  7. Modify [time.zone.link.nonmembers] as indicated:

    bool operator==(const time_zone_link& x, const time_zone_link& y) noexcept;
    

    1 Returns: x.name() == y.name().

    strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y) noexcept;
    

    2 Returns: x.name() <=> y.name().