aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_time.rb
Commit message (Collapse)AuthorAgeFilesLines
* Support %U/%u/%W/%w/%V/%g/%G formats in Time.strptimeJeremy Evans2019-11-211-0/+11
| | | | | | | | | | | | | | | | Most of these formats were documented as supported, but were not actually supported. Document that %g and %G are supported. If %U/%W is specified without yday and mon/mday are not specified, then Date.strptime is used to get the appropriate yday. If cwyear is specifier without the year, or cwday and cweek are specified without mday and mon, then use Date.strptime and convert the resulting value to Time, since Time.make_time cannot handle those conversions Fixes [Bug #9836] Fixes [Bug #14241]
* Test for "%p" in Time.strptimenobu2019-01-081-0/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix mday overflownobu2019-01-061-0/+4
| | | | | | [ruby-core:90897] [Bug #15506] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Time.parse based from non-Time objectnobu2018-10-091-0/+19
| | | | | | | | | | | | * 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
* time.rb: yday supportnobu2018-07-241-0/+10
| | | | | | | * 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
* time.rb: fix parsing time zone in iso8601nobu2018-05-281-0/+1
| | | | | | | | * 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
* time.rb: fix parsing time zone in iso8601nobu2018-05-281-0/+1
| | | | | | | * 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
* Make Time.parse respect timezone offset secondsnobu2017-10-201-0/+7
| | | | | | | | | | | | 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
* Time.parse's "now" argument as nil works again.akr2016-11-051-0/+5
| | | | | | | | | | | * lib/time.rb (make_time): "now" argument as nil works again. This is broken since Ruby 2.2. Mathieu Jobin pointed a problem. https://github.com/ruby/ruby/commit/e4b05d91eb0d48fd172abf015c493bb42d755d07#commitcomment-17421387 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb: revert r54167 because it would breaksonots2016-04-191-32/+0
| | | | | | | | 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
* * lib/time.rb (parse, strptime): Fix Time.parse/strptime does notsonots2016-03-171-0/+32
| | | | | | | 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
* * lib/time.rb: Specify frozen_string_literal: true.akr2015-11-141-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add tests for strptime("%s.%N").akr2015-03-011-0/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_time.rb: fix method to testnobu2014-12-301-7/+7
| | | | | | | * 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
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * 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
* test_time.rb: test_iso8601nobu2014-10-311-76/+85
| | | | | | | * 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
* Fix `Time.parse` for out of range arguments with an offsetnobu2014-07-191-0/+3
| | | | | | | | | | | | * 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
* * lib/time.rb (Time.make_time): Adjust the time zone of "now".akr2014-05-061-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a comment.akr2014-05-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptimeakr2014-05-051-0/+5
| | | | | | | | | 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
* * lib/time.rb (Time.rfc2822): Fix year completion.akr2014-05-031-23/+43
| | | | | | | | | 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
* * lib/time.rb (make_time): Produce fixed-offset time object ifakr2014-05-031-0/+13
| | | | | | | | | | | | 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
* add tests.akr2014-05-031-2/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is notakr2014-05-031-0/+1
| | | | | | | | | 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
* * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns localakr2013-10-071-1/+1
| | | | | | | 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
* * lib/time.rb (Time.strptime): Use :offset.akr2013-10-071-0/+2
| | | | | | | | Patch by Felipe Contreras. [ruby-core:57694] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb (Time#xmlschema): use strftime specifiers instead ofnobu2012-02-281-0/+7
| | | | | | | 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
* * lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.naruse2011-10-041-0/+1
| | | | | | 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
* * strftime.c (rb_strftime_with_timespec): improved style consistency.yugui2011-05-311-0/+6
| | | | | | | | 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
* add an assertion.akr2010-06-241-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * strftime.c: %Y format a year with 4 digits at least.akr2009-11-241-0/+9
| | | | | | | | * 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
* * time.c (rb_gmtime, rb_localtime): gmtime and localtime returnnobu2009-05-251-1/+1
| | | | | | | NULL on error. [ruby-core:23551] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/test_time.rb: make tests timezone independent.akr2009-05-181-2/+2
| | | | | | | | reported by zunda. [ruby-dev:38492] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb (Time#rfc2822): pad leading zeros for year.akr2009-04-211-0/+13
| | | | | | | | | (Time#httpdate): ditto. (Time#xmlschema): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb (Time#xmlschema): use subsec instead of nsec.akr2009-04-211-0/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/time.rb (Time.parse): raise ArgumentError if Date._parse don'takr2009-02-141-0/+1
| | | | | | | | extract date information. [ruby-core:20912] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/test_time.rb: extracted from lib/time.rb.akr2009-02-141-4/+363
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/test_*.rb: Pathname#parent -> Pathname#dirname.nahi2004-01-131-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/inlinetest.rb, test/{test_generator.rb,test_ipaddr.rb,nahi2004-01-061-0/+4
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