Yana Agun Siswanto
Yana Agun Siswanto

Reputation: 2032

Get time object from nano second?

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)

Upvotes: 0

Views: 792

Answers (1)

chailong
chailong

Reputation: 326

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

Upvotes: 1

Related Questions