Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into remove_tests

  • Loading branch information...
commit e327128321805e1c54ff23bee4041e586733018f 2 parents 0a19663 + 8a103e4
@olbrich olbrich authored
View
2  CHANGELOG.txt
@@ -1,5 +1,7 @@
Change Log for Ruby-units
=========================
+2012-02-01 * Fix issue #34 -- Time.at takes more than one parameter
+ * Fix issue #35 -- 'pt' is ambiguous
2012-01-02 1.4.0 * Fix some definitions that were just wrong (amu, dalton)
* Definition uses name of unit if no aliases provided
* Refactor definition process. New units are immediately available
View
8 lib/ruby_units/time.rb
@@ -11,13 +11,15 @@ class << self
# Convert a duration to a Time value by considering the duration to be the number of seconds since the
# epoch
+ # @param [Time] arg
+ # @param [Integer] ms
# @return [Unit, Time]
- def self.at(arg)
+ def self.at(arg,ms=0)
case arg
when Unit
- unit_time_at(arg.convert_to("s").scalar)
+ unit_time_at(arg.convert_to("s").scalar, ms)
else
- unit_time_at(arg)
+ unit_time_at(arg, ms)
end
end
View
4 lib/ruby_units/unit_definitions/standard.rb
@@ -71,11 +71,11 @@
Unit.define('point') do |point|
point.definition = Unit('1/72 ft')
- point.aliases = %w{pt point points}
+ point.aliases = %w{point points}
end
Unit.define('pica') do |pica|
- pica.definition = Unit('12 pt')
+ pica.definition = Unit('12 point')
pica.aliases = %w{P pica picas}
end
View
1  spec/ruby-units/time_spec.rb
@@ -8,6 +8,7 @@
context ".at" do
subject { Date.new(2011,4,1).to_unit }
specify { Time.at(subject - Date.new(1970,1,1)).strftime("%D %T").should == "03/31/11 20:00:00"}
+ specify { Time.at(subject - Date.new(1970,1,1), 500).usec.should == 500}
end
context ".in" do
Please sign in to comment.
Something went wrong with that request. Please try again.