File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -562,11 +562,6 @@ private Ruby(RubyInstanceConfig config) {
562562 getLoadService ().require ("subspawn/replace-builtin" );
563563 }
564564 }
565-
566- // FIXME: How should this be loaded as it is not really stdlib but depends on stdlib to be loaded.
567- try {
568- getLoadService ().require ("time" );
569- } catch (LoadError e ) {} // work-around failed classpath only test (which must be omitting stdlib somehow)
570565 }
571566
572567 private void initProfiling () {
Original file line number Diff line number Diff line change @@ -29,3 +29,4 @@ module JRuby
2929load 'jruby/kernel/thread.rb'
3030load 'jruby/kernel/data.rb'
3131load 'jruby/kernel/integer.rb'
32+ load 'jruby/kernel/time.rb'
Original file line number Diff line number Diff line change 1+ class Time
2+ # From stdlib time library, see https://github.com/jruby/jruby/issues/8476
3+ unless method_defined? ( :xmlschema )
4+ #
5+ # Returns a string which represents the time as a dateTime defined by XML
6+ # Schema:
7+ #
8+ # CCYY-MM-DDThh:mm:ssTZD
9+ # CCYY-MM-DDThh:mm:ss.sssTZD
10+ #
11+ # where TZD is Z or [+-]hh:mm.
12+ #
13+ # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
14+ #
15+ # +fraction_digits+ specifies a number of digits to use for fractional
16+ # seconds. Its default value is 0.
17+ #
18+ # require 'time'
19+ #
20+ # t = Time.now
21+ # t.iso8601 # => "2011-10-05T22:26:12-04:00"
22+ #
23+ # You must require 'time' to use this method.
24+ #
25+ def xmlschema ( fraction_digits = 0 )
26+ fraction_digits = fraction_digits . to_i
27+ s = strftime ( "%FT%T" )
28+ if fraction_digits > 0
29+ s << strftime ( ".%#{ fraction_digits } N" )
30+ end
31+ s << ( utc? ? 'Z' : strftime ( "%:z" ) )
32+ end
33+ end
34+ alias iso8601 xmlschema unless method_defined? ( :iso8601 )
35+ end
You can’t perform that action at this time.
0 commit comments