lib/bson/object_id/uuid_convertable.rb in bson-objectid-to-uuid-0.1.1 vs lib/bson/object_id/uuid_convertable.rb in bson-objectid-to-uuid-0.1.2

- old
+ new

@@ -41,10 +41,10 @@ timestamp = parts[0].to_i(16) + (parts[1].to_i(16) << 32) + ((parts[2].to_i(16) & 0x0FFF) << 48) machine_pid = parts[4][2..-1] high_counter = parts[4][0..1] mid_counter = parts[3][2..3] - low_counter = timestamp % 10_000_000 + low_counter = (timestamp % 10_000_000) & 0xFF seconds = (timestamp - GREGORIAN_EPOCH_OFFSET) / 10_000_000 from_string(format('%06x', seconds) + machine_pid + high_counter + mid_counter + format('%02x', low_counter)) end