From 24d3dacf0182bc28c0f2987e85f8b708abd0ac8a Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Wed, 23 Aug 2023 09:05:44 -0400 Subject: [PATCH] Make timezone a per-instance value. Timezone and clock should be handled similarly. If clocks are switched back to resources, then timezones could be switched back as well. --- example-world.md | 24 +----------------------- wit/timezone.wit | 20 ++------------------ 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/example-world.md b/example-world.md index 6f768f8..f716f89 100644 --- a/example-world.md +++ b/example-world.md @@ -149,7 +149,7 @@ also known as Unix Time. #### `record timezone-display`

Information useful for displaying the timezone of a specific datetime.

-

This information may vary within a single timezone to reflect daylight +

This information may vary within a single timezone to reflect daylight saving time adjustments.

Record Fields
-

type timezone

-

u32

-

A timezone. -

In timezones that recognize daylight saving time, also known as daylight -time and summer time, the information returned from the functions varies -over time to reflect these adjustments.

-

This represents a resource.


Functions

-

instance-timezone: func

-

Return the system timezone, creating the resource.

-
Return values
-

display: func

Return information needed to display the given datetime. This includes the UTC offset, the time zone name, and a flag indicating whether @@ -203,7 +190,6 @@ daylight saving time is active.

saving time.

Params
Return values
@@ -214,17 +200,9 @@ saving time.

The same as display, but only return the UTC offset.

Params
Return values
-

drop-timezone: func

-

Dispose of the specified input-stream, after which it may no longer -be used.

-
Params
- diff --git a/wit/timezone.wit b/wit/timezone.wit index 41734f6..a872bff 100644 --- a/wit/timezone.wit +++ b/wit/timezone.wit @@ -1,18 +1,6 @@ interface timezone { use wall-clock.{datetime} - /// A timezone. - /// - /// In timezones that recognize daylight saving time, also known as daylight - /// time and summer time, the information returned from the functions varies - /// over time to reflect these adjustments. - /// - /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). - type timezone = u32 - - /// Return the system timezone, creating the resource. - instance-timezone: func() -> timezone - /// 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. @@ -20,14 +8,10 @@ interface timezone { /// 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(this: timezone, when: datetime) -> timezone-display + display: func(when: datetime) -> timezone-display /// The same as `display`, but only return the UTC offset. - utc-offset: func(this: timezone, when: datetime) -> s32 - - /// Dispose of the specified input-stream, after which it may no longer - /// be used. - drop-timezone: func(this: timezone) + utc-offset: func(when: datetime) -> s32 /// Information useful for displaying the timezone of a specific `datetime`. ///