I have a string timestamp:
ts = '1550989255.000300'
How can I parse ts
in a Time
or Datetime
object as t
, and have t.strftime('%6N')
print correctly?
I did:
t = Time.at(ts.to_f)
t.strftime '%6N' #=> "000299"
Ruby chops off one microsecond when converting a timestamp to a string.