diff options
author | Simon Rettberg | 2015-09-01 16:55:54 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-09-01 16:55:54 +0200 |
commit | 374ea9aebe968801af7fe834e381b6fafed66f3a (patch) | |
tree | edf2512f1e7fba0c621e1ecdd27f3a886bd5f804 /src/main/java/org | |
parent | Make machineDescription binary in TransferInformation (diff) | |
download | master-sync-shared-374ea9aebe968801af7fe834e381b6fafed66f3a.tar.gz master-sync-shared-374ea9aebe968801af7fe834e381b6fafed66f3a.tar.xz master-sync-shared-374ea9aebe968801af7fe834e381b6fafed66f3a.zip |
Util.unixTime()
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/openslx/util/Util.java | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/main/java/org/openslx/util/Util.java b/src/main/java/org/openslx/util/Util.java index 24daf4c..03c1337 100644 --- a/src/main/java/org/openslx/util/Util.java +++ b/src/main/java/org/openslx/util/Util.java @@ -51,14 +51,15 @@ public class Util * @param defaultValue fallback value if given string can't be parsed * @return */ - public static int parseInt(String value, int defaultValue) { + public static int parseInt( String value, int defaultValue ) + { try { - return Integer.parseInt(value); - } catch (Exception e) { + return Integer.parseInt( value ); + } catch ( Exception e ) { return defaultValue; } } - + public static void safeClose( Closeable... closeable ) { for ( Closeable c : closeable ) { @@ -70,7 +71,7 @@ public class Util } } } - + public static void safeClose( AutoCloseable... closeable ) { for ( AutoCloseable c : closeable ) { @@ -82,8 +83,9 @@ public class Util } } } - - public static boolean sleep(int millis) { + + public static boolean sleep( int millis ) + { try { Thread.sleep( millis ); return true; @@ -92,8 +94,9 @@ public class Util return false; } } - - public static boolean joinThread(Thread t) { + + public static boolean joinThread( Thread t ) + { try { t.join(); return true; @@ -101,4 +104,10 @@ public class Util return false; } } + + public static long unixTime() + { + return System.currentTimeMillis() / 1000; + } + } |