Created
December 2, 2017 15:27
-
-
Save suginoy/c4bc004f6b3deac2186bfb73d94e30df to your computer and use it in GitHub Desktop.
Implement Javascript's Date#getTime() in Ruby
This file contains 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
# JavaScript の Date#getTime は Ruby の Time#to_i と違い、 UNIX 時刻のミリ秒まで入る | |
class Time | |
def javascript_date_get_time | |
("#{to_i * 1000}#{('%03d' % (usec / 1000))}").to_i | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment