Created
March 16, 2014 14:56
-
-
Save GUI/9584445 to your computer and use it in GitHub Desktop.
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
def fast_string_to_time(string) | |
matches = string.match(Format::ISO_DATETIME) | |
if matches | |
microsec = (matches[7].to_r * 1_000_000).to_i | |
new_time matches[1].to_i, matches[2].to_i, matches[3].to_i, matches[4].to_i, matches[5].to_i, matches[6].to_i, microsec | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment