Permalink
Browse files

Full retooling of Time

Pulls in the public domain strftime that gets %z right (imported from
1.9)
  • Loading branch information...
1 parent 9be27e6 commit 4b2580afb1602ae4168ec0ba5774e0f28de37f18 Evan Phoenix committed Feb 11, 2010
Showing with 1,350 additions and 489 deletions.
  1. +29 −14 kernel/bootstrap/time.rb
  2. +140 −269 kernel/common/time.rb
  3. +101 −107 vm/builtin/time.cpp
  4. +28 −17 vm/builtin/time.hpp
  5. +3 −82 vm/test/test_time.hpp
  6. +1,048 −0 vm/util/time.c
  7. +1 −0 vm/util/time.h
View
@@ -1,26 +1,41 @@
class Time
- def self.allocate
- Ruby.primitive :time_allocate
- raise PrimitiveFailure, "Time.allocate primitive failed"
+ def self.now
+ Ruby.primitive :time_s_now
+ raise PrimitiveFailure, "Time.now primitive failed"
end
- def gettimeofday
- Ruby.primitive :time_gettimeofday
- raise PrimitiveFailure, "Time#gettimeofday primitive failed"
+ def self.specific(sec, usec, from_gmt)
+ Ruby.primitive :time_s_specific
+ raise PrimitiveFailure, "Time.specific primitive failed"
end
- def time_switch(sec, to_gmt)
- Ruby.primitive :time_switch
- raise PrimitiveFailure, "Time#time_switch primitive failed"
+ def self.from_array(sec, min, hour, mday, month, year, usec, is_dst, from_gmt)
+ Ruby.primitive :time_s_from_array
+ raise PrimitiveFailure, "Time.from_array primitive failed"
end
- def time_mktime(sec, min, hour, mday, mon, year, usec, isdst, from_gmt)
- Ruby.primitive :time_mktime
- raise ArgumentError, "Time#time_mktime primitive failed, time out of range"
+ def dup
+ Ruby.primitive :time_dup
+ raise PrimitiveFailure, "Time#dup failed"
end
- def __strftime__(tm, format)
+ def seconds
+ Ruby.primitive :time_seconds
+ raise PrimitiveFailure, "Time#second failed"
+ end
+
+ def usec
+ Ruby.primitive :time_useconds
+ raise PrimitiveFailure, "Time#usec failed"
+ end
+
+ def decomposed(gmt)
+ Ruby.primitive :time_decompose
+ raise PrimitiveFailure, "Time#decompose primitive failed"
+ end
+
+ def strftime(format)
Ruby.primitive :time_strftime
- raise PrimitiveFailure, "Time#__strftime__ primitive failed"
+ raise PrimitiveFailure, "Time#strftime primitive failed"
end
end
Oops, something went wrong.

0 comments on commit 4b2580a

Please sign in to comment.