From 974d88a12b6825f3de1cc8fe6337d3523bd305b9 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 10 Nov 2023 10:10:03 -0800 Subject: [PATCH] Remove timezone interface from wasi-clocks (#7515) * delete wasi-clocks timezone interface: import wit changes from https://github.com/WebAssembly/wasi-clocks/pull/55 * remove other references to wasi:clocks/timezone in wits * remove todo! implementation of clocks/timezone and add_to_linker funcs --- crates/wasi-http/wit/deps/cli/reactor.wit | 1 - crates/wasi-http/wit/deps/clocks/timezone.wit | 48 ------------------- crates/wasi-http/wit/deps/clocks/world.wit | 1 - crates/wasi-http/wit/deps/http/proxy.wit | 1 - crates/wasi/src/preview2/command.rs | 4 -- crates/wasi/src/preview2/host/clocks.rs | 11 ----- crates/wasi/wit/deps/cli/reactor.wit | 1 - crates/wasi/wit/deps/clocks/timezone.wit | 48 ------------------- crates/wasi/wit/deps/clocks/world.wit | 1 - crates/wasi/wit/deps/http/proxy.wit | 1 - 10 files changed, 117 deletions(-) delete mode 100644 crates/wasi-http/wit/deps/clocks/timezone.wit delete mode 100644 crates/wasi/wit/deps/clocks/timezone.wit diff --git a/crates/wasi-http/wit/deps/cli/reactor.wit b/crates/wasi-http/wit/deps/cli/reactor.wit index 4b829834c25b..639f755574da 100644 --- a/crates/wasi-http/wit/deps/cli/reactor.wit +++ b/crates/wasi-http/wit/deps/cli/reactor.wit @@ -3,7 +3,6 @@ package wasi:cli@0.2.0-rc-2023-11-05; world reactor { import wasi:clocks/wall-clock@0.2.0-rc-2023-11-05; import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-05; - import wasi:clocks/timezone@0.2.0-rc-2023-11-05; import wasi:filesystem/types@0.2.0-rc-2023-11-05; import wasi:filesystem/preopens@0.2.0-rc-2023-11-05; import wasi:sockets/instance-network@0.2.0-rc-2023-11-05; diff --git a/crates/wasi-http/wit/deps/clocks/timezone.wit b/crates/wasi-http/wit/deps/clocks/timezone.wit deleted file mode 100644 index e717e7b8dda9..000000000000 --- a/crates/wasi-http/wit/deps/clocks/timezone.wit +++ /dev/null @@ -1,48 +0,0 @@ -interface timezone { - use wall-clock.{datetime}; - - /// Return information needed to display the given `datetime`. This includes - /// the UTC offset, the time zone name, and a flag indicating whether - /// daylight saving time is active. - /// - /// If the timezone cannot be determined for the given `datetime`, return a - /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight - /// saving time. - display: func(when: datetime) -> timezone-display; - - /// The same as `display`, but only return the UTC offset. - utc-offset: func(when: datetime) -> s32; - - /// Information useful for displaying the timezone of a specific `datetime`. - /// - /// This information may vary within a single `timezone` to reflect daylight - /// saving time adjustments. - record timezone-display { - /// The number of seconds difference between UTC time and the local - /// time of the timezone. - /// - /// The returned value will always be less than 86400 which is the - /// number of seconds in a day (24*60*60). - /// - /// In implementations that do not expose an actual time zone, this - /// should return 0. - utc-offset: s32, - - /// The abbreviated name of the timezone to display to a user. The name - /// `UTC` indicates Coordinated Universal Time. Otherwise, this should - /// reference local standards for the name of the time zone. - /// - /// In implementations that do not expose an actual time zone, this - /// should be the string `UTC`. - /// - /// In time zones that do not have an applicable name, a formatted - /// representation of the UTC offset may be returned, such as `-04:00`. - name: string, - - /// Whether daylight saving time is active. - /// - /// In implementations that do not expose an actual time zone, this - /// should return false. - in-daylight-saving-time: bool, - } -} diff --git a/crates/wasi-http/wit/deps/clocks/world.wit b/crates/wasi-http/wit/deps/clocks/world.wit index a53d025b85b0..046145582787 100644 --- a/crates/wasi-http/wit/deps/clocks/world.wit +++ b/crates/wasi-http/wit/deps/clocks/world.wit @@ -3,5 +3,4 @@ package wasi:clocks@0.2.0-rc-2023-11-05; world imports { import monotonic-clock; import wall-clock; - import timezone; } diff --git a/crates/wasi-http/wit/deps/http/proxy.wit b/crates/wasi-http/wit/deps/http/proxy.wit index 3fa8b9c631d9..4bc4eb644896 100644 --- a/crates/wasi-http/wit/deps/http/proxy.wit +++ b/crates/wasi-http/wit/deps/http/proxy.wit @@ -8,7 +8,6 @@ world proxy { /// HTTP proxies have access to time and randomness. import wasi:clocks/wall-clock@0.2.0-rc-2023-11-05; import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-05; - import wasi:clocks/timezone@0.2.0-rc-2023-11-05; import wasi:random/random@0.2.0-rc-2023-11-05; /// Proxies have standard output and error streams which are expected to diff --git a/crates/wasi/src/preview2/command.rs b/crates/wasi/src/preview2/command.rs index 898311157354..fe3609fb71a4 100644 --- a/crates/wasi/src/preview2/command.rs +++ b/crates/wasi/src/preview2/command.rs @@ -11,7 +11,6 @@ wasmtime::component::bindgen!({ "wasi:clocks/monotonic_clock": crate::preview2::bindings::clocks::monotonic_clock, "wasi:io/poll": crate::preview2::bindings::io::poll, "wasi:io/streams": crate::preview2::bindings::io::streams, - "wasi:clocks/timezone": crate::preview2::bindings::clocks::timezone, "wasi:clocks/wall_clock": crate::preview2::bindings::clocks::wall_clock, "wasi:random/random": crate::preview2::bindings::random::random, "wasi:cli/environment": crate::preview2::bindings::cli::environment, @@ -30,7 +29,6 @@ wasmtime::component::bindgen!({ pub fn add_to_linker(l: &mut wasmtime::component::Linker) -> anyhow::Result<()> { crate::preview2::bindings::clocks::wall_clock::add_to_linker(l, |t| t)?; crate::preview2::bindings::clocks::monotonic_clock::add_to_linker(l, |t| t)?; - crate::preview2::bindings::clocks::timezone::add_to_linker(l, |t| t)?; crate::preview2::bindings::filesystem::types::add_to_linker(l, |t| t)?; crate::preview2::bindings::filesystem::preopens::add_to_linker(l, |t| t)?; crate::preview2::bindings::io::poll::add_to_linker(l, |t| t)?; @@ -71,7 +69,6 @@ pub mod sync { "wasi:clocks/monotonic_clock": crate::preview2::bindings::clocks::monotonic_clock, "wasi:io/poll": crate::preview2::bindings::sync_io::io::poll, "wasi:io/streams": crate::preview2::bindings::sync_io::io::streams, - "wasi:clocks/timezone": crate::preview2::bindings::clocks::timezone, "wasi:clocks/wall_clock": crate::preview2::bindings::clocks::wall_clock, "wasi:random/random": crate::preview2::bindings::random::random, "wasi:cli/environment": crate::preview2::bindings::cli::environment, @@ -92,7 +89,6 @@ pub mod sync { ) -> anyhow::Result<()> { crate::preview2::bindings::clocks::wall_clock::add_to_linker(l, |t| t)?; crate::preview2::bindings::clocks::monotonic_clock::add_to_linker(l, |t| t)?; - crate::preview2::bindings::clocks::timezone::add_to_linker(l, |t| t)?; crate::preview2::bindings::sync_io::filesystem::types::add_to_linker(l, |t| t)?; crate::preview2::bindings::filesystem::preopens::add_to_linker(l, |t| t)?; crate::preview2::bindings::sync_io::io::poll::add_to_linker(l, |t| t)?; diff --git a/crates/wasi/src/preview2/host/clocks.rs b/crates/wasi/src/preview2/host/clocks.rs index 0b4c7dd364a2..4467b3681ec3 100644 --- a/crates/wasi/src/preview2/host/clocks.rs +++ b/crates/wasi/src/preview2/host/clocks.rs @@ -2,7 +2,6 @@ use crate::preview2::bindings::{ clocks::monotonic_clock::{self, Duration as WasiDuration, Instant}, - clocks::timezone::{self, TimezoneDisplay}, clocks::wall_clock::{self, Datetime}, }; use crate::preview2::poll::{subscribe, Subscribe}; @@ -102,13 +101,3 @@ impl Subscribe for Deadline { } } } - -impl timezone::Host for T { - fn display(&mut self, when: Datetime) -> anyhow::Result { - todo!("timezone display is not implemented") - } - - fn utc_offset(&mut self, when: Datetime) -> anyhow::Result { - todo!("timezone utc_offset is not implemented") - } -} diff --git a/crates/wasi/wit/deps/cli/reactor.wit b/crates/wasi/wit/deps/cli/reactor.wit index 4b829834c25b..639f755574da 100644 --- a/crates/wasi/wit/deps/cli/reactor.wit +++ b/crates/wasi/wit/deps/cli/reactor.wit @@ -3,7 +3,6 @@ package wasi:cli@0.2.0-rc-2023-11-05; world reactor { import wasi:clocks/wall-clock@0.2.0-rc-2023-11-05; import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-05; - import wasi:clocks/timezone@0.2.0-rc-2023-11-05; import wasi:filesystem/types@0.2.0-rc-2023-11-05; import wasi:filesystem/preopens@0.2.0-rc-2023-11-05; import wasi:sockets/instance-network@0.2.0-rc-2023-11-05; diff --git a/crates/wasi/wit/deps/clocks/timezone.wit b/crates/wasi/wit/deps/clocks/timezone.wit deleted file mode 100644 index e717e7b8dda9..000000000000 --- a/crates/wasi/wit/deps/clocks/timezone.wit +++ /dev/null @@ -1,48 +0,0 @@ -interface timezone { - use wall-clock.{datetime}; - - /// Return information needed to display the given `datetime`. This includes - /// the UTC offset, the time zone name, and a flag indicating whether - /// daylight saving time is active. - /// - /// If the timezone cannot be determined for the given `datetime`, return a - /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight - /// saving time. - display: func(when: datetime) -> timezone-display; - - /// The same as `display`, but only return the UTC offset. - utc-offset: func(when: datetime) -> s32; - - /// Information useful for displaying the timezone of a specific `datetime`. - /// - /// This information may vary within a single `timezone` to reflect daylight - /// saving time adjustments. - record timezone-display { - /// The number of seconds difference between UTC time and the local - /// time of the timezone. - /// - /// The returned value will always be less than 86400 which is the - /// number of seconds in a day (24*60*60). - /// - /// In implementations that do not expose an actual time zone, this - /// should return 0. - utc-offset: s32, - - /// The abbreviated name of the timezone to display to a user. The name - /// `UTC` indicates Coordinated Universal Time. Otherwise, this should - /// reference local standards for the name of the time zone. - /// - /// In implementations that do not expose an actual time zone, this - /// should be the string `UTC`. - /// - /// In time zones that do not have an applicable name, a formatted - /// representation of the UTC offset may be returned, such as `-04:00`. - name: string, - - /// Whether daylight saving time is active. - /// - /// In implementations that do not expose an actual time zone, this - /// should return false. - in-daylight-saving-time: bool, - } -} diff --git a/crates/wasi/wit/deps/clocks/world.wit b/crates/wasi/wit/deps/clocks/world.wit index a53d025b85b0..046145582787 100644 --- a/crates/wasi/wit/deps/clocks/world.wit +++ b/crates/wasi/wit/deps/clocks/world.wit @@ -3,5 +3,4 @@ package wasi:clocks@0.2.0-rc-2023-11-05; world imports { import monotonic-clock; import wall-clock; - import timezone; } diff --git a/crates/wasi/wit/deps/http/proxy.wit b/crates/wasi/wit/deps/http/proxy.wit index 3fa8b9c631d9..4bc4eb644896 100644 --- a/crates/wasi/wit/deps/http/proxy.wit +++ b/crates/wasi/wit/deps/http/proxy.wit @@ -8,7 +8,6 @@ world proxy { /// HTTP proxies have access to time and randomness. import wasi:clocks/wall-clock@0.2.0-rc-2023-11-05; import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-05; - import wasi:clocks/timezone@0.2.0-rc-2023-11-05; import wasi:random/random@0.2.0-rc-2023-11-05; /// Proxies have standard output and error streams which are expected to