Sha256: a2d1e3e2bcbbaddff41263a6adb2840f3566f5f808fea695b0e526470c15f7ff
Contents?: true
Size: 468 Bytes
Versions: 1
Compression:
Stored size: 468 Bytes
Contents
class Time # Formats time as "HH:MM:SS" (e.g. "23:59:59"). Equivalent to # <code>strftime("%H:%M:%S")</code>, but faster. # # @return [String] the time formatted as "HH:MM:SS" def to_hms # Date#strftime appears to be **much** faster than Time#strftime # (nearly 3x faster!). If Time#strftime becomes optimized to that # level in the future, it should be used instead of sprintf. sprintf('%02d:%02d:%02d'.freeze, hour, min, sec) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
casual_support-2.0.0 | lib/casual_support/time/to_hms.rb |