diff software/mpdl-services/mpiwg-mpdl-lt/src/de/mpg/mpiwg/berlin/mpdl/util/Util.java @ 19:4a3641ae14d2

Erstellung
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Wed, 09 Nov 2011 15:32:05 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/software/mpdl-services/mpiwg-mpdl-lt/src/de/mpg/mpiwg/berlin/mpdl/util/Util.java	Wed Nov 09 15:32:05 2011 +0100
@@ -0,0 +1,32 @@
+package de.mpg.mpiwg.berlin.mpdl.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Properties;
+
+public class Util {
+
+  public Properties getProperties(String fullFileName) {
+    Properties props = new Properties(); 
+    try {
+      File file = new File(fullFileName);
+      FileInputStream in = new FileInputStream(file);
+      props.load(in);
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    return props;
+  }
+  
+  public Double getSecondWithMillisecondsBetween(Date begin, Date end) {
+    long beginMS = begin.getTime();
+    long endMS = end.getTime();
+    long elapsedSeconds = (endMS - beginMS) / 1000;
+    long elapsedMilliSecondsAfterSeconds1 = (endMS - beginMS) - (elapsedSeconds * 1000);
+    Double seconds = new Double(elapsedSeconds + "." + elapsedMilliSecondsAfterSeconds1); 
+    return seconds;
+  }
+ 
+}