Permalink
Browse files

add Utils.convertTimeStringToInt

  • Loading branch information...
1 parent 51f1f62 commit d0ffc93124e3c0db0265d5faa80e6fc6a3fffe21 @vitriolix vitriolix committed Apr 3, 2013
Showing with 18 additions and 0 deletions.
  1. +18 −0 app/src/info/guardianproject/mrapp/Utils.java
@@ -1,5 +1,8 @@
package info.guardianproject.mrapp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.widget.Toast;
@@ -13,4 +16,19 @@ public void run() {
}
});
}
+
+ /**
+ *
+ * @param timeString in 00:00:00.000 format (hour:min:second.ms)
+ * @return time in ms
+ */
+ public static int convertTimeStringToInt(String timeString) {
+ int duration = 0;
+ try {
+ duration = (int) (new SimpleDateFormat("hh:mm:ss.SS").parse(timeString)).getTime();
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return duration;
+ }
}

0 comments on commit d0ffc93

Please sign in to comment.