Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/midwire_common/time.rb

Overview

A more useful Time class

Class Method Summary collapse

Class Method Details

.timestamp(resolution = 3) ⇒ Object



4
5
6
7
# File 'lib/midwire_common/time.rb', line 4

def timestamp(resolution = 3)
  return Time.now.strftime('%Y%m%d%H%M%S') if resolution < 1
  Time.now.strftime("%Y%m%d%H%M%S.%#{resolution}N")
end