Created
November 21, 2016 11:14
-
-
Save fragoulis/3c78f50b7fc3181cd6241fb54dc13c64 to your computer and use it in GitHub Desktop.
Time extensions for
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Nanotime | |
def in_seconds(now = ::Time.current) | |
now.strftime("%s000000000") | |
end | |
def in_milliseconds(now = ::Time.current) | |
now.strftime("%s%3N000000") | |
end | |
def in_microseconds(now = ::Time.current) | |
now.strftime("%s%6N000") | |
end | |
def in_nanoseconds(now = ::Time.current) | |
now.strftime("%s%9N") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment