ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:121083] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set
@ 2025-02-17 12:46 nobu (Nobuyoshi Nakada) via ruby-core
  2025-02-17 12:51 ` [ruby-core:121084] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-02-17 12:46 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21144 has been reported by nobu (Nobuyoshi Nakada).

----------------------------------------
Bug #21144: Win32: Use Windows time zone ID as the time zone name if TZ is not set
https://bugs.ruby-lang.org/issues/21144

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
### Problem

On Windows, the `Time#zone` uses `_tzname` provided by the runtime library.
This is obtained by using `GetTimeZoneInformation`, if the `TZ` environment variable is not set or empty.

The problem is that the `StandardName` and `DaylightName` in that information are for UI, and localized.
This means that these names may vary across different international editions and language packs, even for the same time zone.

### Solution

Use the Windows time zone ID by using `GetDynamicTimeZoneInformation`, which is available since Windows Vista and Windows Server 2008.
Since the `TimeZoneKeyName` is the registry key of time zones, the above problem does not occur.

This is also mitigate [Bug #20929].
Even it is possible to define non-ascii key name time zone, there is no such name in the standard installations.

### Compatibilities etc

- This also changes the result of `Time#inspect`, may not be good for ones who prefer the display names for UI.
- There is no way to restore `zone` from `Marshal` data, this does *not* improve.
- The PR changes the signature of `ruby_reset_timezone()` and marks internal use only, but this function is declared in `internal/time.h` and probably no problem.




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:121084] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set
  2025-02-17 12:46 [ruby-core:121083] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set nobu (Nobuyoshi Nakada) via ruby-core
@ 2025-02-17 12:51 ` nobu (Nobuyoshi Nakada) via ruby-core
  2025-03-04 21:04 ` [ruby-core:121237] " ufuk (Ufuk Kayserilioglu) via ruby-core
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-02-17 12:51 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21144 has been updated by nobu (Nobuyoshi Nakada).

Assignee set to windows

----------------------------------------
Bug #21144: Win32: Use Windows time zone ID as the time zone name if TZ is not set
https://bugs.ruby-lang.org/issues/21144#change-112003

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Assignee: windows
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
### Problem

On Windows, the `Time#zone` uses `_tzname` provided by the runtime library.
This is obtained by using `GetTimeZoneInformation`, if the `TZ` environment variable is not set or empty.

The problem is that the `StandardName` and `DaylightName` in that information are for UI, and localized.
This means that these names may vary across different international editions and language packs, even for the same time zone.

### Solution

Use the Windows time zone ID by using `GetDynamicTimeZoneInformation`, which is available since Windows Vista and Windows Server 2008.
Since the `TimeZoneKeyName` is the registry key of time zones, the above problem does not occur.

This is also mitigate [Bug #20929].
Even it is possible to define non-ascii key name time zone, there is no such name in the standard installations.

### Compatibilities etc

- This also changes the result of `Time#inspect`, may not be good for ones who prefer the display names for UI.
- There is no way to restore `zone` from `Marshal` data, this does *not* improve.
- The PR [GH-12765] changes the signature of `ruby_reset_timezone()` and marks internal use only, but this function is declared in `internal/time.h` and probably no problem.

[GH-12765]: https://github.com/ruby/ruby/pull/12765




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:121237] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set
  2025-02-17 12:46 [ruby-core:121083] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set nobu (Nobuyoshi Nakada) via ruby-core
  2025-02-17 12:51 ` [ruby-core:121084] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2025-03-04 21:04 ` ufuk (Ufuk Kayserilioglu) via ruby-core
  2025-03-10  6:52 ` [ruby-core:121273] " hsbt (Hiroshi SHIBATA) via ruby-core
  2025-03-16  9:50 ` [ruby-core:121381] [Ruby " nagachika (Tomoyuki Chikanaga) via ruby-core
  3 siblings, 0 replies; 5+ messages in thread
From: ufuk (Ufuk Kayserilioglu) via ruby-core @ 2025-03-04 21:04 UTC (permalink / raw)
  To: ruby-core; +Cc: ufuk (Ufuk Kayserilioglu)

Issue #21144 has been updated by ufuk (Ufuk Kayserilioglu).

Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE

ruby_3_4 commit:d40c6cf7b606edb815adf7a8e9abe98f38a8f747.

----------------------------------------
Bug #21144: Win32: Use Windows time zone ID as the time zone name if TZ is not set
https://bugs.ruby-lang.org/issues/21144#change-112185

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Assignee: windows
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE
----------------------------------------
### Problem

On Windows, the `Time#zone` uses `_tzname` provided by the runtime library.
This is obtained by using `GetTimeZoneInformation`, if the `TZ` environment variable is not set or empty.

The problem is that the `StandardName` and `DaylightName` in that information are for UI, and localized.
This means that these names may vary across different international editions and language packs, even for the same time zone.

### Solution

Use the Windows time zone ID by using `GetDynamicTimeZoneInformation`, which is available since Windows Vista and Windows Server 2008.
Since the `TimeZoneKeyName` is the registry key of time zones, the above problem does not occur.

This is also mitigate [Bug #20929].
Even it is possible to define non-ascii key name time zone, there is no such name in the standard installations.

### Compatibilities etc

- This also changes the result of `Time#inspect`, may not be good for ones who prefer the display names for UI.
- There is no way to restore `zone` from `Marshal` data, this does *not* improve.
- The PR [GH-12765] changes the signature of `ruby_reset_timezone()` and marks internal use only, but this function is declared in `internal/time.h` and probably no problem.

[GH-12765]: https://github.com/ruby/ruby/pull/12765




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:121273] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set
  2025-02-17 12:46 [ruby-core:121083] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set nobu (Nobuyoshi Nakada) via ruby-core
  2025-02-17 12:51 ` [ruby-core:121084] " nobu (Nobuyoshi Nakada) via ruby-core
  2025-03-04 21:04 ` [ruby-core:121237] " ufuk (Ufuk Kayserilioglu) via ruby-core
@ 2025-03-10  6:52 ` hsbt (Hiroshi SHIBATA) via ruby-core
  2025-03-16  9:50 ` [ruby-core:121381] [Ruby " nagachika (Tomoyuki Chikanaga) via ruby-core
  3 siblings, 0 replies; 5+ messages in thread
From: hsbt (Hiroshi SHIBATA) via ruby-core @ 2025-03-10  6:52 UTC (permalink / raw)
  To: ruby-core; +Cc: hsbt (Hiroshi SHIBATA)

Issue #21144 has been updated by hsbt (Hiroshi SHIBATA).

Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE to 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED, 3.4: DONE

ruby_3_2 commit:f7ec9546ee07298f5d0aed6fc245e2405fe950bc merged revision(s) commit:3f07bc76ff6a11232d9f18e5eaa31835c195e8f0, commit:34098b669c0cbc024cd08e686891f1dfe0a10aaf.

----------------------------------------
Bug #21144: Win32: Use Windows time zone ID as the time zone name if TZ is not set
https://bugs.ruby-lang.org/issues/21144#change-112229

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Assignee: windows
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED, 3.4: DONE
----------------------------------------
### Problem

On Windows, the `Time#zone` uses `_tzname` provided by the runtime library.
This is obtained by using `GetTimeZoneInformation`, if the `TZ` environment variable is not set or empty.

The problem is that the `StandardName` and `DaylightName` in that information are for UI, and localized.
This means that these names may vary across different international editions and language packs, even for the same time zone.

### Solution

Use the Windows time zone ID by using `GetDynamicTimeZoneInformation`, which is available since Windows Vista and Windows Server 2008.
Since the `TimeZoneKeyName` is the registry key of time zones, the above problem does not occur.

This is also mitigate [Bug #20929].
Even it is possible to define non-ascii key name time zone, there is no such name in the standard installations.

### Compatibilities etc

- This also changes the result of `Time#inspect`, may not be good for ones who prefer the display names for UI.
- There is no way to restore `zone` from `Marshal` data, this does *not* improve.
- The PR [GH-12765] changes the signature of `ruby_reset_timezone()` and marks internal use only, but this function is declared in `internal/time.h` and probably no problem.

[GH-12765]: https://github.com/ruby/ruby/pull/12765




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:121381] [Ruby Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set
  2025-02-17 12:46 [ruby-core:121083] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set nobu (Nobuyoshi Nakada) via ruby-core
                   ` (2 preceding siblings ...)
  2025-03-10  6:52 ` [ruby-core:121273] " hsbt (Hiroshi SHIBATA) via ruby-core
@ 2025-03-16  9:50 ` nagachika (Tomoyuki Chikanaga) via ruby-core
  3 siblings, 0 replies; 5+ messages in thread
From: nagachika (Tomoyuki Chikanaga) via ruby-core @ 2025-03-16  9:50 UTC (permalink / raw)
  To: ruby-core; +Cc: nagachika (Tomoyuki Chikanaga)

Issue #21144 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED, 3.4: DONE to 3.1: REQUIRED, 3.2: DONE, 3.3: DONE, 3.4: DONE

ruby_3_3 commit:d213eb7f453fa0bd6c476826c450d9726c3c8b15 merged revision(s) commit:3f07bc76ff6a11232d9f18e5eaa31835c195e8f0, commit:34098b669c0cbc024cd08e686891f1dfe0a10aaf.

----------------------------------------
Bug #21144: Win32: Use Windows time zone ID as the time zone name if TZ is not set
https://bugs.ruby-lang.org/issues/21144#change-112352

* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Assignee: windows
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: DONE, 3.4: DONE
----------------------------------------
### Problem

On Windows, the `Time#zone` uses `_tzname` provided by the runtime library.
This is obtained by using `GetTimeZoneInformation`, if the `TZ` environment variable is not set or empty.

The problem is that the `StandardName` and `DaylightName` in that information are for UI, and localized.
This means that these names may vary across different international editions and language packs, even for the same time zone.

### Solution

Use the Windows time zone ID by using `GetDynamicTimeZoneInformation`, which is available since Windows Vista and Windows Server 2008.
Since the `TimeZoneKeyName` is the registry key of time zones, the above problem does not occur.

This is also mitigate [Bug #20929].
Even it is possible to define non-ascii key name time zone, there is no such name in the standard installations.

### Compatibilities etc

- This also changes the result of `Time#inspect`, may not be good for ones who prefer the display names for UI.
- There is no way to restore `zone` from `Marshal` data, this does *not* improve.
- The PR [GH-12765] changes the signature of `ruby_reset_timezone()` and marks internal use only, but this function is declared in `internal/time.h` and probably no problem.

[GH-12765]: https://github.com/ruby/ruby/pull/12765




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-16  9:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-17 12:46 [ruby-core:121083] [Ruby master Bug#21144] Win32: Use Windows time zone ID as the time zone name if TZ is not set nobu (Nobuyoshi Nakada) via ruby-core
2025-02-17 12:51 ` [ruby-core:121084] " nobu (Nobuyoshi Nakada) via ruby-core
2025-03-04 21:04 ` [ruby-core:121237] " ufuk (Ufuk Kayserilioglu) via ruby-core
2025-03-10  6:52 ` [ruby-core:121273] " hsbt (Hiroshi SHIBATA) via ruby-core
2025-03-16  9:50 ` [ruby-core:121381] [Ruby " nagachika (Tomoyuki Chikanaga) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).