Get time object from nano second?

747 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 answers

0
chailong On

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