<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/time.c, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 3f07bc76ff6a11232d9f18e5eaa31835c195e8f0, 34098b669c0cbc024cd08e686891f1dfe0a10aaf: [Backport #21144]</title>
<updated>2025-03-10T06:48:58+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2025-03-10T06:48:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f7ec9546ee07298f5d0aed6fc245e2405fe950bc'/>
<id>f7ec9546ee07298f5d0aed6fc245e2405fe950bc</id>
<content type='text'>
	[Bug #21144] Win32: Use Windows time zone ID if TZ is not set

	If the TZ environment variable is not set, the time zone names
	retrieved from the system are localized for UI display and may vary
	across editions and language packs for the same time zone.
	Use the time zone IDs that are invariant across environments instead.

	[Bug #21144] Win32: Convert the time zone name to the current locale

	The Windows time zone IDs provided by Microsoft as of 24H1 are ASCII
	only all, but the API itself is not impossible to set non-ASCII key
	name.  Prefer the current locale encoding for now until we move to
	UTF-8 including environment variables and command line arguments.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #21144] Win32: Use Windows time zone ID if TZ is not set

	If the TZ environment variable is not set, the time zone names
	retrieved from the system are localized for UI display and may vary
	across editions and language packs for the same time zone.
	Use the time zone IDs that are invariant across environments instead.

	[Bug #21144] Win32: Convert the time zone name to the current locale

	The Windows time zone IDs provided by Microsoft as of 24H1 are ASCII
	only all, but the API itself is not impossible to set non-ASCII key
	name.  Prefer the current locale encoding for now until we move to
	UTF-8 including environment variables and command line arguments.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 055613fd868a8c94e43893f8c58a00cdd2a81f6d: [Backport #20447]</title>
<updated>2024-12-15T06:31:58+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-12-15T06:31:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=59254caff0f39c87370d0c11793e3aae5c38d6e1'/>
<id>59254caff0f39c87370d0c11793e3aae5c38d6e1</id>
<content type='text'>
	Fix pointer incompatiblity

	Since the subsecond part is discarded, WIDEVAL to VALUE conversion is
	needed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix pointer incompatiblity

	Since the subsecond part is discarded, WIDEVAL to VALUE conversion is
	needed.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) d3279a0c11ca45ca85027e7eb74dc4aac52c478b: [Backport #20327]</title>
<updated>2024-04-07T05:53:48+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-04-07T05:53:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e6bf38a6e7fbae0097fdf51e3c752820a2c58ae4'/>
<id>e6bf38a6e7fbae0097fdf51e3c752820a2c58ae4</id>
<content type='text'>
	[Bug #20327] Do not count subsecond to calculate UTC offset

	Assume that there will never be any time zones with UTC offsets that
	are subseconds.  Historically, UTC offset has only been used down to
	the second.
	---
	 test/ruby/test_time_tz.rb | 8 ++++++++
	 time.c                    | 2 +-
	 2 files changed, 9 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20327] Do not count subsecond to calculate UTC offset

	Assume that there will never be any time zones with UTC offsets that
	are subseconds.  Historically, UTC offset has only been used down to
	the second.
	---
	 test/ruby/test_time_tz.rb | 8 ++++++++
	 time.c                    | 2 +-
	 2 files changed, 9 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 5d4fff845602872eef072e7611558b5f8762efe0: [Backport #19293]</title>
<updated>2023-07-23T03:20:12+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-07-23T03:20:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0b3ed6043c9d091d499ca1caed604a983c7e285b'/>
<id>0b3ed6043c9d091d499ca1caed604a983c7e285b</id>
<content type='text'>
	Tighten Time.new(string) parsing

	Disallow:

	* Only year-month
	* Only year-month-day
	* Preceding whitespace
	* Trailing whitespace

	Fixes [Bug #19293]
	---
	 test/ruby/test_time.rb | 13 +++++++++++++
	 time.c                 | 13 ++++++++++++-
	 2 files changed, 25 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Tighten Time.new(string) parsing

	Disallow:

	* Only year-month
	* Only year-month-day
	* Preceding whitespace
	* Trailing whitespace

	Fixes [Bug #19293]
	---
	 test/ruby/test_time.rb | 13 +++++++++++++
	 time.c                 | 13 ++++++++++++-
	 2 files changed, 25 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) a84c99468f26a9f79fec57926d561ed906505eac: [Backport #19575]</title>
<updated>2023-07-17T00:45:57+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-07-17T00:45:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cb8d656100659eaee44042ca680886c30892df04'/>
<id>cb8d656100659eaee44042ca680886c30892df04</id>
<content type='text'>
	Fix crash in Time on 32-bit systems

	[Bug #19575]

	struct vtm is packed causing it to have a size that is not aligned on
	32-bit systems. When allocating it on the stack, it will have unaligned
	addresses which means that the fields won't be marked by the GC when
	scanning the stack (since the GC only marks aligned addresses). This can
	cause crashes when the fields are heap allocated objects like Bignums.

	This commit moves the flags in struct time_object into struct vtm for
	space efficiency and removes the need for packing.

	This is an example of a crash:

	    ruby(rb_print_backtrace+0xd) [0x56848945] ../src/vm_dump.c:785
	    ruby(rb_vm_bugreport) ../src/vm_dump.c:1101
	    ruby(rb_assert_failure+0x7a) [0x56671857] ../src/error.c:878
	    ruby(vm_search_cc+0x0) [0x56666e47] ../src/vm_method.c:1366
	    ruby(rb_vm_search_method_slowpath) ../src/vm_insnhelper.c:2090
	    ruby(callable_method_entry+0x5) [0x568232d3] ../src/vm_method.c:1406
	    ruby(rb_callable_method_entry) ../src/vm_method.c:1413
	    ruby(gccct_method_search_slowpath) ../src/vm_eval.c:427
	    ruby(gccct_method_search+0x20f) [0x568237ef] ../src/vm_eval.c:476
	    ruby(opt_equality_by_mid_slowpath+0x2c) [0x5682388c] ../src/vm_insnhelper.c:2338
	    ruby(rb_equal+0x37) [0x566fe577] ../src/object.c:133
	    ruby(rb_big_eq+0x34) [0x56876ee4] ../src/bignum.c:5554
	    ruby(rb_int_equal+0x14) [0x566f3ed4] ../src/numeric.c:4640
	    ruby(rb_int_equal) ../src/numeric.c:4634
	    ruby(vm_call0_cfunc_with_frame+0x6d) [0x568303c2] ../src/vm_eval.c:148
	    ruby(vm_call0_cfunc) ../src/vm_eval.c:162
	    ruby(vm_call0_body) ../src/vm_eval.c:208
	    ruby(rb_funcallv_scope+0xd1) [0x56833971] ../src/vm_eval.c:85
	    ruby(RB_TEST+0x0) [0x567e8488] ../src/time.c:78
	    ruby(eq) ../src/time.c:78
	    ruby(small_vtm_sub) ../src/time.c:1523
	    ruby(timelocalw+0x23b) [0x567f3e9b] ../src/time.c:1593
	    ruby(time_s_alloc+0x0) [0x567f536b] ../src/time.c:3698
	    ruby(time_new_timew) ../src/time.c:2694
	    ruby(time_s_mktime) ../src/time.c:3698
	---
	 test/ruby/test_time.rb |  7 ++-----
	 time.c                 | 57 ++++++++++++++++++++++++--------------------------
	 timev.h                |  7 +++++--
	 3 files changed, 34 insertions(+), 37 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix crash in Time on 32-bit systems

	[Bug #19575]

	struct vtm is packed causing it to have a size that is not aligned on
	32-bit systems. When allocating it on the stack, it will have unaligned
	addresses which means that the fields won't be marked by the GC when
	scanning the stack (since the GC only marks aligned addresses). This can
	cause crashes when the fields are heap allocated objects like Bignums.

	This commit moves the flags in struct time_object into struct vtm for
	space efficiency and removes the need for packing.

	This is an example of a crash:

	    ruby(rb_print_backtrace+0xd) [0x56848945] ../src/vm_dump.c:785
	    ruby(rb_vm_bugreport) ../src/vm_dump.c:1101
	    ruby(rb_assert_failure+0x7a) [0x56671857] ../src/error.c:878
	    ruby(vm_search_cc+0x0) [0x56666e47] ../src/vm_method.c:1366
	    ruby(rb_vm_search_method_slowpath) ../src/vm_insnhelper.c:2090
	    ruby(callable_method_entry+0x5) [0x568232d3] ../src/vm_method.c:1406
	    ruby(rb_callable_method_entry) ../src/vm_method.c:1413
	    ruby(gccct_method_search_slowpath) ../src/vm_eval.c:427
	    ruby(gccct_method_search+0x20f) [0x568237ef] ../src/vm_eval.c:476
	    ruby(opt_equality_by_mid_slowpath+0x2c) [0x5682388c] ../src/vm_insnhelper.c:2338
	    ruby(rb_equal+0x37) [0x566fe577] ../src/object.c:133
	    ruby(rb_big_eq+0x34) [0x56876ee4] ../src/bignum.c:5554
	    ruby(rb_int_equal+0x14) [0x566f3ed4] ../src/numeric.c:4640
	    ruby(rb_int_equal) ../src/numeric.c:4634
	    ruby(vm_call0_cfunc_with_frame+0x6d) [0x568303c2] ../src/vm_eval.c:148
	    ruby(vm_call0_cfunc) ../src/vm_eval.c:162
	    ruby(vm_call0_body) ../src/vm_eval.c:208
	    ruby(rb_funcallv_scope+0xd1) [0x56833971] ../src/vm_eval.c:85
	    ruby(RB_TEST+0x0) [0x567e8488] ../src/time.c:78
	    ruby(eq) ../src/time.c:78
	    ruby(small_vtm_sub) ../src/time.c:1523
	    ruby(timelocalw+0x23b) [0x567f3e9b] ../src/time.c:1593
	    ruby(time_s_alloc+0x0) [0x567f536b] ../src/time.c:3698
	    ruby(time_new_timew) ../src/time.c:2694
	    ruby(time_s_mktime) ../src/time.c:3698
	---
	 test/ruby/test_time.rb |  7 ++-----
	 time.c                 | 57 ++++++++++++++++++++++++--------------------------
	 timev.h                |  7 +++++--
	 3 files changed, 34 insertions(+), 37 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 291a4098cf649c027cb50c16b872455f26ad1dfb,5be0d42d2c4dc765230c76738289560f9ee37f09: [Backport #19296]</title>
<updated>2023-01-18T08:17:27+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2023-01-18T08:17:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=52ea5ea9906c3a96c60a68e01b303672602a6832'/>
<id>52ea5ea9906c3a96c60a68e01b303672602a6832</id>
<content type='text'>
	Add missing assertion

	---
	 test/ruby/test_time.rb | 3 +++
	 1 file changed, 3 insertions(+)

	[Bug #19296] Precheck bits of time components

	---
	 test/ruby/test_time.rb | 15 +++++++++++++++
	 time.c                 | 14 ++++++++------
	 2 files changed, 23 insertions(+), 6 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Add missing assertion

	---
	 test/ruby/test_time.rb | 3 +++
	 1 file changed, 3 insertions(+)

	[Bug #19296] Precheck bits of time components

	---
	 test/ruby/test_time.rb | 15 +++++++++++++++
	 time.c                 | 14 ++++++++------
	 2 files changed, 23 insertions(+), 6 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 542e984d82fa25098eb15398d716d907acc52b93: [Backport #19292]</title>
<updated>2023-01-17T02:21:00+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2023-01-17T02:21:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=89cd61890fe78e0491708f87a5df678b03fda8a3'/>
<id>89cd61890fe78e0491708f87a5df678b03fda8a3</id>
<content type='text'>
	[Bug #19292] Re-initialize tm when wday or yday is not set

	---
	 test/ruby/test_time.rb |  3 ++-
	 time.c                 | 31 ++++++++++++++++++++++---------
	 2 files changed, 24 insertions(+), 10 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19292] Re-initialize tm when wday or yday is not set

	---
	 test/ruby/test_time.rb |  3 ++-
	 time.c                 | 31 ++++++++++++++++++++++---------
	 2 files changed, 24 insertions(+), 10 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Update documentation about Time#deconstruct_keys</title>
<updated>2022-12-22T04:05:09+00:00</updated>
<author>
<name>Kazuki Tsujimoto</name>
<email>kazuki@callcc.net</email>
</author>
<published>2022-12-22T04:05:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b7bb14b96e7e1923d91787fa5a9ca2e4053431b1'/>
<id>b7bb14b96e7e1923d91787fa5a9ca2e4053431b1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] fix unintentional verbatim</title>
<updated>2022-12-21T00:48:42+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-12-20T23:34:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2b96119fc00a49813c169d811e43a49ba9833f5f'/>
<id>2b96119fc00a49813c169d811e43a49ba9833f5f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix guess_diff type</title>
<updated>2022-12-19T04:14:46+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-12-19T04:14:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d64e10228da1cabf07c3d5f6289e219a12d4cd86'/>
<id>d64e10228da1cabf07c3d5f6289e219a12d4cd86</id>
<content type='text'>
`unsigned_time_t` has the same size as `time_t`, but it doesn't mean
these types are same except for signedness.  For instance, while
`long` and `long long` has the same size and `time_t` is defined as
the latter on 64bit OpenBSD, `unsigned_time_t` has been defined as
`long`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`unsigned_time_t` has the same size as `time_t`, but it doesn't mean
these types are same except for signedness.  For instance, while
`long` and `long long` has the same size and `time_t` is defined as
the latter on 64bit OpenBSD, `unsigned_time_t` has been defined as
`long`.
</pre>
</div>
</content>
</entry>
</feed>
