Get time object from nano second?

802 Views Asked by At

I have a nanosecond integer need to be formated as Time object in ruby. How can i get Time object from nanosecond in ruby ?

I tried

Time.strptime '2318482693000', '%N'

but the time returned is current time not the exact time given (in nanoseconds)

1

There are 1 best solutions below

0
On

You'd better consider use Time#at. But you have to adjust your nano elapse a little bit.