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

38 Коммитов

Автор SHA1 Сообщение Дата
nobu e52b102c36 Test for "%p" in Time.strptime
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-08 07:45:04 +00:00
nobu 6629588aa5 Fix mday overflow
[ruby-core:90897] [Bug #15506]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-06 04:36:56 +00:00
nobu 7f9089a186 Time.parse based from non-Time object
* lib/time.rb (Time.make_time): as the document states, the second
  argument of `Time.parse` may be a non-`Time` object which does not
  have `getlocal` method, assume it is in the local time in the case.
  based on the patch by nkmrya (Yasuhiro Nakamura) at
  [ruby-core:68775].  [ruby-core:68775] [Bug #11037]

Co-authored-by: nkmrya (Yasuhiro Nakamura) <yasuhiro6194@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-09 05:55:29 +00:00
nobu 728b75bc9b time.rb: yday support
* lib/time.rb (Time.make_time): added yday support.
  [ruby-core:87545] [Bug #14860]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 07:47:01 +00:00
nobu dc2a979b7f time.rb: fix parsing time zone in iso8601
* lib/time.rb (Time.xmlschema): the minute in time zone designator
  can be omitted together with the preceding colon.
  [ruby-core:87277] [Bug #14790]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-28 15:35:08 +00:00
nobu 71fed537ac time.rb: fix parsing time zone in iso8601
* lib/time.rb (Time.xmlschema): a colon in time zone designator
  can be omitted.  [ruby-core:87277] [Bug #14790]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-28 15:19:38 +00:00
nobu 90048176cc Make Time.parse respect timezone offset seconds
DateTime.parse handles them correctly, and DateTime.parse.to_time
results in the correct time.  Time.parse doesn't handle them
correctly because Time.zone_offset uses a different regexp that
only considers hours and minutes, not seconds.
[ruby-core:83400] [Bug #14034]

From: Jeremy Evans <code@jeremyevans.net>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-20 01:03:18 +00:00
akr 5fa7cdbde5 Time.parse's "now" argument as nil works again.
* lib/time.rb (make_time): "now" argument as nil works again.
  This is broken since Ruby 2.2.
  Mathieu Jobin pointed a problem.
  e4b05d91eb (commitcomment-17421387)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 14:03:34 +00:00
sonots 64231b49ca * lib/time.rb: revert r54167 because it would break
backward compatibilities, and it is documented that
  Time.parse does not take into account time zone
  abbreations other than ones described in RFC 822

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19 04:20:48 +00:00
sonots 1ba62fa93a * lib/time.rb (parse, strptime): Fix Time.parse/strptime does not
have compatibility with DateTime.parse/strptime in terms of parsing
  timezone [Bug #12190] [Fix GH-1297]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:46:22 +00:00
akr fb7ccd690e * lib/time.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-14 08:00:29 +00:00
akr a12a453152 add tests for strptime("%s.%N").
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-01 00:13:11 +00:00
nobu 205cf0140d test_time.rb: fix method to test
* test/test_time.rb (subtest_xmlschema_alias): test the specified
  method, not fixed name iso8601.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-30 01:38:41 +00:00
akr fb2008a73a * test/lib/envutil.rb: Moved from test/ruby/.
* test/lib/find_executable.rb: Ditto.

* test/lib/memory_status.rb: Ditto.

* test/lib/test/unit.rb: require envutil.

* test/: Don't require envutil in test files.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 16:05:37 +00:00
nobu 26c13db6e6 test_time.rb: test_iso8601
* test/test_time.rb (TestTimeExtension#test_iso8601): run all
  xmlschema tests with iso8601 method, and fix the test name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-31 08:07:46 +00:00
nobu f75b676cc4 Fix `Time.parse` for out of range arguments with an offset
* lib/time.rb (Time#apply_offset): Guards against a `nil` return
  value from `Time.month_days` when offsetting date.  Out of range
  values are then caught when `Time.utc` is called (as usual).
  Previously a `nil` return value from `Time.month_days` would
  have the `<` operator called on it, and raise `NoMethodError`.
  [fix GH-667]
* lib/rdoc/parser/changelog.rb (RDoc#parse_entries): fix dirty hack.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-19 02:56:39 +00:00
akr e4b05d91eb * lib/time.rb (Time.make_time): Adjust the time zone of "now".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 09:50:08 +00:00
akr 78fa967224 add a comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 07:33:14 +00:00
akr c2a87a1fa1 * lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptime
doesn't extract date information.
  Reported by tadayoshi funaba.  [ruby-core:62349]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 02:47:53 +00:00
akr af56a2b6dc * lib/time.rb (Time.rfc2822): Fix year completion.
Produce fixed-offset time object if appropriate.
  (Time.xmlschema): Produce fixed-offset time object if appropriate.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03 18:11:53 +00:00
akr c4f29a6576 * lib/time.rb (make_time): Produce fixed-offset time object if
appropriate.
  (Time.strptime): Use d[:zone] instead of d[:offset].

* lib/rss/rss.rb (Time.w3cdtf): Produce fixed-offset time object if
  appropriate.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03 15:23:29 +00:00
akr 0a76ec34ea add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03 13:09:07 +00:00
akr 4de238663a * lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is not
given.
  Reported by tadayoshi funaba.  [ruby-core:62322]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03 11:31:33 +00:00
akr a8178c69be * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
time Time object as Ruby 2.0 and before.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 21:00:12 +00:00
akr da6229a3a0 * lib/time.rb (Time.strptime): Use :offset.
Patch by Felipe Contreras.  [ruby-core:57694]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 11:10:03 +00:00
nobu 007b7fcdcf * lib/time.rb (Time#xmlschema): use strftime specifiers instead of
fractional exponential calcuation which yields undesirable
  result.  [ruby-core:42997][Bug #6100]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 08:16:03 +00:00
naruse 4eb497d90b * lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.
Reported by Christopher Eberz. [ruby-core:39903] Bug #5399

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-04 07:37:11 +00:00
yugui 8fa30bbd48 * strftime.c (rb_strftime_with_timespec): improved style consistency.
constified some variables.

* test/test_time.rb (TestTime#test_huge_precision): test for #4456.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 03:59:36 +00:00
akr 90b1eb1317 add an assertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-24 13:37:58 +00:00
akr 54370de9f4 * strftime.c: %Y format a year with 4 digits at least.
* lib/time.rb: format a year with 4 digits at least.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 11:34:45 +00:00
nobu 762fec4946 * time.c (rb_gmtime, rb_localtime): gmtime and localtime return
NULL on error.  [ruby-core:23551]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-25 18:41:32 +00:00
akr cef83891ca * test/test_time.rb: make tests timezone independent.
reported by zunda.  [ruby-dev:38492] 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-18 22:53:05 +00:00
akr d9dd33fc27 * lib/time.rb (Time#rfc2822): pad leading zeros for year.
(Time#httpdate): ditto.
  (Time#xmlschema): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 18:08:47 +00:00
akr fd9bfef325 * lib/time.rb (Time#xmlschema): use subsec instead of nsec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 17:11:27 +00:00
akr 1b4c1f715e * lib/time.rb (Time.parse): raise ArgumentError if Date._parse don't
extract date information.  [ruby-core:20912]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 22:03:28 +00:00
akr 5b512b7fa9 * test/test_time.rb: extracted from lib/time.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 11:19:52 +00:00
nahi 45c950c1df * test/test_*.rb: Pathname#parent -> Pathname#dirname.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-13 04:06:31 +00:00
nahi 79c0e644a1 * test/inlinetest.rb, test/{test_generator.rb,test_ipaddr.rb,
test_pathname.rb,test_pp.rb,test_prettyprint.rb,test_set.rb,
          test_time.rb,test_tsort.rb: added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-06 02:34:24 +00:00