| Age | Commit message (Collapse) | Author |
|
34098b669c0cbc024cd08e686891f1dfe0a10aaf: [Backport #21144]
[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.
|
|
Fix pointer incompatiblity
Since the subsecond part is discarded, WIDEVAL to VALUE conversion is
needed.
|
|
[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(-)
|
|
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(-)
|
|
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(-)
|
|
291a4098cf649c027cb50c16b872455f26ad1dfb,5be0d42d2c4dc765230c76738289560f9ee37f09: [Backport #19296]
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(-)
|
|
[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(-)
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6975
|
|
`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`.
|
|
* 4-digits or more is required as year
* Minutes and seconds parts are not ommittable
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Which limits the precision of subsecond. Defaulted to 9, that
means nanosecond.
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
`Time.new` now parses strings such as the result of `Time#inspect`
and restricted ISO-8601 formats.
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6594
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6721
|
|
|
|
|
|
|
|
|
|
Treats:
#yday
#dst?
#zone
#to_a
#strftime
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
More on timezones.
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
Deletes the :include: files in doc/time, which became no longer workable when @nobu pointed out that some (but not all) creator methods accept string values as well as integer-like values.
Changes to methods:
Time.utc
Time.local
Time.at
Time.new
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
Since RDoc C parser cannot capture aliases which are using an
expression other than a single variable as the class, use an
intermediate variable for the singleton class.
|
|
|
|
Treats:
#utc
#getlocal
#getutc
#ctime
#to_s
#inspect
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
|
|
Treats:
#utc
#hash
#localtime
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
[Misc #18891]
Notes:
Merged: https://github.com/ruby/ruby/pull/6094
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6146
Merged-By: nobu <nobu@ruby-lang.org>
|
|
Treats:
::utc
::local
#to_i
#to_f
#to_r
#usec
#nsec
#subsec
#<=>
#eql?
Notes:
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5937
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5783
|
|
When the date is 28 Feb in the local timezone and 27 in the UTC,
the leap second info is wrongly calculated, and the Time for 1 Mar
created with a timezone resulted in an invalid date, 30 Feb.
|
|
Previously Time.now was switched to use Time.new as it added support for
the in: argument. Unfortunately because Class#new is a cfunc this
requires always allocating a Hash.
This commit switches Time.now back to using a builtin time_s_now. This
avoids the extra Hash allocation and is about 3x faster.
$ benchmark-driver -e './ruby;3.1::~/.rubies/ruby-3.1.0/bin/ruby;3.0::~/.rubies/ruby-3.0.2/bin/ruby' benchmark/time_now.yml
Warming up --------------------------------------
Time.now 6.704M i/s - 6.710M times in 1.000814s (149.16ns/i, 328clocks/i)
Time.now(in: "+09:00") 2.003M i/s - 2.112M times in 1.054330s (499.31ns/i)
Calculating -------------------------------------
./ruby 3.1 3.0
Time.now 7.693M 2.763M 6.394M i/s - 20.113M times in 2.614428s 7.278710s 3.145572s
Time.now(in: "+09:00") 2.030M 1.260M 1.617M i/s - 6.008M times in 2.960132s 4.769378s 3.716537s
Comparison:
Time.now
./ruby: 7693129.7 i/s
3.0: 6394109.2 i/s - 1.20x slower
3.1: 2763282.5 i/s - 2.78x slower
Time.now(in: "+09:00")
./ruby: 2029757.4 i/s
3.0: 1616652.3 i/s - 1.26x slower
3.1: 1259776.2 i/s - 1.61x slower
Notes:
Merged: https://github.com/ruby/ruby/pull/5429
|
|
https://bugs.ruby-lang.org/issues/17485#change-89871
Notes:
Merged: https://github.com/ruby/ruby/pull/5344
|
|
https://hackerone.com/reports/1244185
Notes:
Merged: https://github.com/ruby/ruby/pull/5238
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5112
|
|
|
|
|
|
`struct vtm::year` is a Ruby integer instance, but not a C integer
type.
Notes:
Merged: https://github.com/ruby/ruby/pull/5041
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4864
|
|
Notes:
Merged-By: nurse <naruse@airemix.jp>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4805
|
|
Must not be a bad idea to improve documents. [ci skip]
Notes:
Merged: https://github.com/ruby/ruby/pull/4815
|