Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The method nanoTime() is undefined for the type System in GWT

Tags:

gwt

While compiling my libgdx application in eclipse I keep getting this error:

 [ERROR] Errors in 'file:/C:/Users/Zorfie/Programing/Java/workspace/Libgdx/src/sim/states/BasicBox2DState.java'
      [ERROR] Line 157:  The method nanoTime() is undefined for the type System
      [ERROR] Line 159:  The method nanoTime() is undefined for the type System
      [ERROR] Line 160:  The method nanoTime() is undefined for the type System
      [ERROR] Line 161:  The method nanoTime() is undefined for the type System
   [ERROR] Errors in 'jar:file:/C:/Program%20Files/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201203300216-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/web/bindery/autobean/shared/impl/StringQuoter.java'
      [ERROR] Line 21:  The import org.json cannot be resolved
      [ERROR] Line 69:  JSONObject cannot be resolved
   [ERROR] Errors in 'jar:file:/C:/Program%20Files/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201203300216-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java'
      [ERROR] Line 23:  The import org.json cannot be resolved
      [ERROR] Line 24:  The import org.json cannot be resolved
      [ERROR] Line 25:  The import org.json cannot be resolved
      [ERROR] Line 40:  JSONObject cannot be resolved to a type
      [ERROR] Line 47:  JSONObject cannot be resolved to a type

Which implies that GWT does not support .nanoTime(), is this the case or am I simply running with the wrong JRE? (I checked for the project and it said it was 1.6).

like image 835
Derek Avatar asked Apr 06 '12 16:04

Derek


1 Answers

There is no support for nanoTime() in GWT since there is no support for it in javascript.

The closest analog in GWT is Duration.currentTimeMillis()

like image 79
jusio Avatar answered Nov 19 '22 17:11

jusio