src/modular/bin/basemgr/intl_property_provider_impl/intl_property_provider_impl.cc
std::optional<std::string> TimeZoneIdFrom(const fuchsia::setui::SettingsObject& setting) {
  if (setting.setting_type != fuchsia::setui::SettingType::TIME_ZONE) {
    // Should never happen since the Watch/Listen protocol ensures the setting matches.
    return std::nullopt;
  }
  const fuchsia::setui::TimeZoneInfo& timezone_info = setting.data.time_zone_value();
  if (timezone_info.current == nullptr) {
    return std::nullopt;
  }
  const auto* timezone = setting.data.time_zone_value().current.get();
  if (timezone_info.current->id.empty()) {
    // Weird data in the timezone field causes us to not update anything.
    return std::nullopt;
  }
  return std::string(timezone->id);
}
// Extracts just the timezone ID from the setting object.  If the setting is not
// well-formed or not valid, no value is returned.
Extracts just the timezone ID from the setting object.  If the setting is not
well-formed or not valid, no value is returned.
Extracts just the timezone ID from the setting object . If the setting is not well - formed or not valid no value is returned .
std::optional<std::string> TimeZoneIdFrom(const fuchsia::setui::SettingsObject& setting) {
  if (setting.setting_type != fuchsia::setui::SettingType::TIME_ZONE) {
    return std::nullopt;
  }
  const fuchsia::setui::TimeZoneInfo& timezone_info = setting.data.time_zone_value();
  if (timezone_info.current == nullptr) {
    return std::nullopt;
  }
  const auto* timezone = setting.data.time_zone_value().current.get();
  if (timezone_info.current->id.empty()) {
    return std::nullopt;
  }
  return std::string(timezone->id);
}
std :: optional < std :: string > TimeZoneIdFrom ( const fuchsia :: setui :: SettingsObject & setting ) { if ( setting . setting_type != fuchsia :: setui :: SettingType :: TIME_ZONE ) { return std :: nullopt ; } const fuchsia :: setui :: TimeZoneInfo & timezone_info = setting . data . time_zone_value ( ) ; if ( timezone_info . current == nullptr ) { return std :: nullopt ; } const auto * timezone = setting . data . time_zone_value ( ) . current . get ( ) ; if ( timezone_info . current -> id . empty ( ) ) { return std :: nullopt ; } return std :: string ( timezone -> id ) ; }
Extracts just the timezone ID from the setting object.
Extracts just the timezone ID from the setting object .
// Should never happen since the Watch/Listen protocol ensures the setting matches. // Weird data in the timezone field causes us to not update anything.