Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

workitem #6244, added format '%N' to time.strftime

  • Loading branch information...
commit c9d8339441e21a90216b9b51cffd23f5225d0174 1 parent d4a4496
Enrico Sada authored August 01, 2011
4  Languages/Ruby/Libraries/Builtins/RubyTime.cs
@@ -939,6 +939,10 @@ public static class RubyTimeOps {
939 939
 
940 940
                     case 'M':
941 941
                         dateTimeFormat = "mm";
  942
+                        break;
  943
+
  944
+                    case 'N':
  945
+                        dateTimeFormat = "fffffff00";
942 946
                         break;
943 947
 
944 948
                     case 'p':
5  Languages/Ruby/Tests/mspec/rubyspec/core/time/strftime_spec.rb
@@ -165,6 +165,11 @@
165 165
     time.strftime('%M').should == '06'
166 166
   end
167 167
   
  168
+  it "returns the fractional seconds digits, default is 9 digits (nanosecond) with %N" do
  169
+    time = Time.local(2009, 9, 18, 12, 0, 6, 123456)
  170
+    time.strftime('%N').should == '123456000'
  171
+  end
  172
+
168 173
   it "returns the second with %S" do
169 174
     time = Time.local(2009, 9, 18, 12, 0, 6)
170 175
     time.strftime('%S').should == '06'

0 notes on commit c9d8339

Please sign in to comment.
Something went wrong with that request. Please try again.