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

660 Коммитов

Автор SHA1 Сообщение Дата
BurdetteLamar 3b239d2480 Remove (newly unneeded) remarks about aliases 2023-02-19 14:26:34 -08:00
Nobuyoshi Nakada a56d959ed5
Replace `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` 2023-02-08 12:35:27 +09:00
git 23052e005e * remove trailing spaces. [ci skip] 2023-02-07 21:03:20 +00:00
Peter Zhu 1c0127ed5e Make Time objects WB protected
Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2023-02-07 16:03:08 -05:00
Peter Zhu e9090eb64d Remove unused code in time.c
Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2023-02-07 16:03:08 -05:00
Nobuyoshi Nakada 5be0d42d2c
[Bug #19296] Precheck bits of time components 2023-01-02 23:29:19 +09:00
Nobuyoshi Nakada 542e984d82
[Bug #19292] Re-initialize tm when wday or yday is not set 2023-01-01 16:39:00 +09:00
Kazuki Tsujimoto b7bb14b96e
Update documentation about Time#deconstruct_keys 2022-12-22 13:05:09 +09:00
Nobuyoshi Nakada 2b96119fc0 [DOC] fix unintentional verbatim 2022-12-21 09:48:42 +09:00
Nobuyoshi Nakada d64e10228d
Fix guess_diff type
`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`.
2022-12-19 13:14:46 +09:00
Nobuyoshi Nakada 3e49d62bc1 [Feature #18033] Parse more strictly conformant with ISO-8601
* 4-digits or more is required as year
* Minutes and seconds parts are not ommittable
2022-12-16 22:52:59 +09:00
Nobuyoshi Nakada 635fc5f7fc [Feature #18033] Make more conformant with C standard 2022-12-16 22:52:59 +09: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 67c589afa0 [Feature #18033] More strict checks 2022-12-16 22:52:59 +09:00
Nobuyoshi Nakada 0a2f300a8a [Feature #18033] Name a magic number 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
S-H-GAMELINKS 1f4f6c9832 Using UNDEF_P macro 2022-11-16 18:58:33 +09:00
Nobuyoshi Nakada 5c3dba83fa
Re-order checks for colons in UTC offset 2022-11-15 09:01:29 +09:00
Nobuyoshi Nakada 011d4c57d2
[Bug #19106] Normalize time at 24:00:00 with a timezone object 2022-11-07 15:56:12 +09:00
Nobuyoshi Nakada 1a66d42fca
[DOC] use the local rdoc reference than the external URI 2022-10-11 16:25:09 +09:00
Nobuyoshi Nakada baf050100d
[DOC] Remove extra page-dir prefix to fix broken link 2022-09-03 23:26:07 +09:00
Burdette Lamar fe865c5262
[DOC] Enhanced RDoc for Time (#6320)
Treats:
    #yday
    #dst?
    #zone
    #to_a
    #strftime
2022-09-03 08:36:44 -05:00
Burdette Lamar c8c90e459e
Enhanced RDoc for Tim[DOC] (#6319) 2022-09-02 14:11:53 -05:00
Burdette Lamar d41be1ac37
[DOC] Enhanced RDoc for Time (#6308)
More on timezones.
2022-08-31 16:36:22 -05: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 c069f50401
[DOC] Tell RDoc aliases of singleton class
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.
2022-08-26 00:07:19 +09:00
Nobuyoshi Nakada 6465a5331a
[DOC] Remove extra page-dir prefix 2022-08-23 09:04:57 +09:00
Burdette Lamar b8d142e733
[DOC] Enhanced RDoc for Time (#6267)
Treats:
    #utc
    #getlocal
    #getutc
    #ctime
    #to_s
    #inspect
2022-08-22 11:21:36 -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
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Nobuyoshi Nakada 68903df6f6
[Bug #18922] Normalize time at 24:00:00 UTC 2022-07-18 00:59:27 +09:00
Burdette Lamar 8309b1366c
[DOC] Enhanced RDoc for Time (#6118)
Treats:
    ::utc
    ::local
    #to_i
    #to_f
    #to_r
    #usec
    #nsec
    #subsec
    #<=>
    #eql?
2022-07-12 13:21:32 -05:00
S-H-GAMELINKS 46cf3bf333 Using TZMODE_SET_LOCALTIME macro 2022-05-26 19:55:05 +09:00
S-H-GAMELINKS 5b467400d2 [DOC]Some link prefix replace 2022-04-09 17:43:46 +09:00
Nobuyoshi Nakada 32f356e84a
Fix a typo of macro name
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.
2022-02-28 13:29:18 +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 0867b638af Raise proper exception when month argument is not a name
https://bugs.ruby-lang.org/issues/17485#change-89871
2021-12-25 18:03:50 +09:00
Nobuyoshi Nakada da652e1827
Check month overflow when marshal
https://hackerone.com/reports/1244185
2021-12-09 21:51:39 +09:00
Koichi Sasada 2a3d5d661c Use `Primitive.mandatory_only?` for `Time.at` 2021-11-15 15:58:56 +09: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
Nobuyoshi Nakada 1d666ed50f Fix leap day with UTC offset [Bug #18274]
`struct vtm::year` is a Ruby integer instance, but not a C integer
type.
2021-10-28 14:45:19 +09:00
Nobuyoshi Nakada e057b9eea9
Prefer the reentrant versions of gmtime and localtime 2021-10-14 23:44:15 +09:00
Nobuyoshi Nakada ec4ecb6d6d Include the invalid value in invalid_utc_offset error 2021-09-18 18:03:54 +09:00
S.H 68bd5626c3
Remove unneeded ruby_reset_leap_second_info function declaration (#4824) 2021-09-16 13:21:06 +09:00
S-H-GAMELINKS 032534dbdf Using RB_BIGNUM_TYPE_P macro 2021-09-11 09:13:24 +09:00
卜部昌平 a88bd246ca include/ruby/internal/intern/time.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00