Граф коммитов

37 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 092a17e7bd
[DOC] Markup class name `Time` as code 2023-12-02 21:48:00 +09:00
Nobuyoshi Nakada ae3e9f114c
[DOC] Include timezones document in timev.rb
So that it can be referred as a part of the document of `Time`.
2023-12-02 21:46:52 +09:00
Nobuyoshi Nakada 0bced53a8a
[DOC] Remove extra `+` which is not a part of keyword argument name 2023-11-26 19:37:56 +09:00
Nobuyoshi Nakada 2ecc372a5d
[DOC] State timezone info in the string wins `in:` keyword 2023-11-24 19:38:55 +09:00
Nobuyoshi Nakada 045e74d8e4
[DOC] Simplify signature of `Time.new` 2023-11-24 19:38:55 +09:00
Nobuyoshi Nakada 9d7ac1ba1c
[DOC] Add links about timezones 2023-11-24 19:38:55 +09:00
Burdette Lamar 8c5b9ebf71
[DOC] Improve doc guide compliance (#8221) 2023-08-15 14:43:58 -04:00
Nobuyoshi Nakada 9515179d74 [Feature #18033] Add `precision:` option
Which limits the precision of subsecond. Defaulted to 9, that
means nanosecond.
2022-12-16 22:52:59 +09:00
Nobuyoshi Nakada 8c272f4481 [Feature #18033] Make Time.new parse time strings
`Time.new` now parses strings such as the result of `Time#inspect`
and restricted ISO-8601 formats.
2022-12-16 22:52:59 +09:00
zverok eaf2b6c439 Add Time#deconstruct_keys 2022-11-22 23:10:46 +02:00
Nobuyoshi Nakada a145a204ec
[DOC] Update about `sec` argument of `Time.new` 2022-11-17 21:52:50 +09:00
Burdette Lamar d41be1ac37
[DOC] Enhanced RDoc for Time (#6308)
More on timezones.
2022-08-31 16:36:22 -05:00
Jeremy Evans 055fc7b14d Fix comment in timev.rb 2022-08-28 14:57:36 -07:00
Burdette Lamar aecc3b1252
[DOC] Enhanced RDoc for Time (#6294) 2022-08-28 16:49:51 -05:00
Burdette Lamar 8706b74b90
[DOC] Enhanced RDoc for Time (#6277)
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
2022-08-25 13:02:18 -05:00
Nobuyoshi Nakada f99904341e
[DOC] Remove extra page-dir prefix 2022-08-22 23:15:30 +09:00
Burdette Lamar 936327a519
[DOC] Enhanced RDoc for Time (#6255)
Treats:
    #utc
    #hash
    #localtime
2022-08-21 11:36:36 -05:00
Nobuyoshi Nakada dfa17f46a8
[DOC] prefer rdoc references over generated URLs 2022-02-19 15:14:01 +09:00
Nobuyoshi Nakada 50c972a1ae
[DOC] Simplify operator method references 2022-02-12 12:38:36 +09:00
John Hawthorn 2f71f6bb82 Speed up and avoid kwarg hash alloc in Time.now
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
2022-01-12 12:55:14 -08:00
Nobuyoshi Nakada 433a5a0eb0
[DOC] Fix Time.new description [ci skip] 2021-12-03 13:17:38 +09:00
Koichi Sasada 2a3d5d661c Use `Primitive.mandatory_only?` for `Time.at` 2021-11-15 15:58:56 +09:00
Benoit Daloze 8d5f38a8a4 Use Primitive. in timev.rb for consistency with all other .rb files 2021-11-10 19:51:59 +01:00
Nobuyoshi Nakada 8bcff5604b
Tentative fix of subsec to `Time.at` [Bug #18293] 2021-11-10 18:14:14 +09:00
Nobuyoshi Nakada 83bdc2f00c
Simplify default values of `Time.at` [Bug #18293] 2021-11-10 17:42:18 +09:00
Burdette Lamar 94dea77cd6
Links for What's Here sections (#4827)
Makes What's Here sections in Time and Dir link to What's Here for super and included modules (like all the others).
2021-09-13 10:37:15 -05:00
Nobuyoshi Nakada 83244b8c89
[DOC] Match each `Time.now` for comparison [ci skip] 2021-08-23 14:12:21 +09:00
Nobuyoshi Nakada c741ea0be7
timev.rb: moved class rdoc from time.c 2021-06-07 20:44:05 +09:00
Nobuyoshi Nakada 30d2d72663
Shrink timev.rb iseq size 2021-05-08 11:40:20 +09:00
Burdette Lamar 86b4c2fc3f
What's Here for class Dir (#4472)
What's Here for class Dir
2021-05-07 15:14:08 -05:00
Burdette Lamar 6ee55455a8 Update Time documentation 2021-04-29 19:58:15 -07:00
Nobuyoshi Nakada e9b93d67ba
Positional and keyword arguments for timezone are exclusive
[Feature #17485]
2021-01-13 18:37:36 +09:00
Nobuyoshi Nakada 4b15caee8f
Added `in:` timezone option to `Time.new` [Feature #17485] 2021-01-13 18:15:50 +09:00
Marcus Stollsteimer 3108ad7bf3 [DOC] Fix grammar: "is same as" -> "is the same as" 2021-01-05 15:13:53 +01:00
Nobuyoshi Nakada 77e7082e82
Moved Time.at to builtin 2020-12-31 17:25:07 +09:00
Nobuyoshi Nakada 9101597d05
Moved Time.now to builtin 2020-12-31 17:25:07 +09:00
Nobuyoshi Nakada 93735f8fc0
Moved time.rb to timev.rb 2020-12-31 17:23:37 +09:00