add three rs functions: uptimeMillis, startTimeMillis, elapsedTimeMillis
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index b0b8404..efe6ff7 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -20,6 +20,7 @@
 
 #include "acc/acc.h"
 #include "utils/String8.h"
+#include "utils/Timers.h"
 
 #include <GLES/gl.h>
 #include <GLES/glext.h>
@@ -62,6 +63,11 @@
         rsc->setVertex(mEnviroment.mVertex.get());
     }
 
+    if (launchIndex == 0) {
+        mEnviroment.mStartTimeMillis
+                = nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
+    }
+
     bool ret = false;
     tls->mScript = this;
     ret = mProgram.mScript(launchIndex) != 0;
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index ecd8373..1ef6b4e 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -21,6 +21,7 @@
 
 #include "acc/acc.h"
 #include "utils/String8.h"
+#include "utils/Timers.h"
 
 #include <GLES/gl.h>
 #include <GLES/glext.h>
@@ -261,7 +262,7 @@
 // Time routines
 //////////////////////////////////////////////////////////////////////////////
 
-static uint32_t SC_second()
+static int32_t SC_second()
 {
     GET_TLS();
 
@@ -279,7 +280,7 @@
     }
 }
 
-static uint32_t SC_minute()
+static int32_t SC_minute()
 {
     GET_TLS();
 
@@ -297,7 +298,7 @@
     }
 }
 
-static uint32_t SC_hour()
+static int32_t SC_hour()
 {
     GET_TLS();
 
@@ -315,7 +316,7 @@
     }
 }
 
-static uint32_t SC_day()
+static int32_t SC_day()
 {
     GET_TLS();
 
@@ -333,7 +334,7 @@
     }
 }
 
-static uint32_t SC_month()
+static int32_t SC_month()
 {
     GET_TLS();
 
@@ -351,7 +352,7 @@
     }
 }
 
-static uint32_t SC_year()
+static int32_t SC_year()
 {
     GET_TLS();
 
@@ -369,6 +370,24 @@
     }
 }
 
+static int32_t SC_uptimeMillis()
+{
+    return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
+}
+
+static int32_t SC_startTimeMillis()
+{
+    GET_TLS();
+    return sc->mEnviroment.mStartTimeMillis;
+}
+
+static int32_t SC_elapsedTimeMillis()
+{
+    GET_TLS();
+    return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC))
+            - sc->mEnviroment.mStartTimeMillis;
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // Matrix routines
 //////////////////////////////////////////////////////////////////////////////
@@ -895,6 +914,12 @@
         "int", "()" },
     { "year", (void *)&SC_year,
         "int", "()" },
+    { "uptimeMillis", (void*)&SC_uptimeMillis,
+        "int", "()" },      // TODO: use long instead
+    { "startTimeMillis", (void*)&SC_startTimeMillis,
+        "int", "()" },      // TODO: use long instead
+    { "elapsedTimeMillis", (void*)&SC_elapsedTimeMillis,
+        "int", "()" },      // TODO: use long instead
 
     // matrix
     { "matrixLoadIdentity", (void *)&SC_matrixLoadIdentity,