Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert python time.time() to java.nanoTime()

java's System.nanoTime() seems to give a long: 1337203874231141000L while python time.time() will give something like 1337203880.462787

how can i convert time.time()'s value to something match up to System.nanoTime()?

like image 634
hoi-hung tsang Avatar asked May 16 '12 21:05

hoi-hung tsang


1 Answers

You can't.

From the documentation:

This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents nanoseconds since some fixed but arbitrary time (perhaps in the future, so values may be negative).

like image 123
Mark Byers Avatar answered Oct 20 '22 08:10

Mark Byers