Permalink
Browse files

Change a few uses of math to TimeConversionUtil

  • Loading branch information...
LadyCailin committed May 5, 2018
1 parent dc1c688 commit 95670d2b4dfc18ba071cfa02f3a814e27c6afeda
@@ -3,6 +3,7 @@
import com.laytonsmith.PureUtilities.ClassLoading.ClassDiscovery;
import com.laytonsmith.PureUtilities.ClassLoading.ClassMirror.ClassMirror;
import com.laytonsmith.PureUtilities.Common.StreamUtils;
import com.laytonsmith.PureUtilities.Common.TimeConversionUtil;
import com.laytonsmith.PureUtilities.VirtualFS.VirtualFileSystemSettings.VirtualFileSystemSetting;
import java.io.File;
import java.io.IOException;
@@ -119,7 +120,7 @@ public void run() {
try {
FSSize = FileUtils.sizeOfDirectoryAsBigInteger(root);
//Sleep for a minute before running again.
Thread.sleep(60 * 1000);
Thread.sleep(TimeConversionUtil.inMilliseconds(1, TimeConversionUtil.TimeUnit.MINUTE));
} catch(InterruptedException ex) {
Logger.getLogger(VirtualFileSystem.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -25,6 +25,7 @@
import com.laytonsmith.PureUtilities.Common.ReflectionUtils;
import com.laytonsmith.PureUtilities.Common.StreamUtils;
import com.laytonsmith.PureUtilities.Common.StringUtils;
import com.laytonsmith.PureUtilities.Common.TimeConversionUtil;
import com.laytonsmith.PureUtilities.ExecutionQueue;
import com.laytonsmith.PureUtilities.SimpleVersion;
import com.laytonsmith.PureUtilities.TermColors;
@@ -576,7 +577,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if(sender instanceof ConsoleCommandSender) {
int interpreterTimeout = Prefs.InterpreterTimeout();
if(interpreterTimeout != 0) {
interpreterUnlockedUntil = (interpreterTimeout * 60 * 1000) + System.currentTimeMillis();
interpreterUnlockedUntil =
TimeConversionUtil.inMilliseconds(interpreterTimeout, TimeConversionUtil.TimeUnit.MINUTE)
+ System.currentTimeMillis();
sender.sendMessage("Interpreter mode unlocked for " + interpreterTimeout + " minute"
+ (interpreterTimeout == 1 ? "" : "s"));
}

0 comments on commit 95670d2

Please sign in to comment.