Skip to content

Commit

Permalink
Fixing time display for withdrawal times.
Browse files Browse the repository at this point in the history
  • Loading branch information
palmada committed Dec 7, 2018
1 parent 4c2e7dd commit cb14f92
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
Binary file modified NanoJ-Fluidics.jar
Binary file not shown.
Binary file modified NanoJ-Fluidics_IJ.jar
Binary file not shown.
Binary file modified NanoJ-Fluidics_MM.jar
Binary file not shown.
Binary file modified PackagedBinaries/NanoJ-Fluidics.zip
Binary file not shown.
Binary file modified PackagedBinaries/NanoJ-Fluidics_IJ.zip
Binary file not shown.
Binary file modified PackagedBinaries/NanoJ-Fluidics_MM.zip
Binary file not shown.
20 changes: 14 additions & 6 deletions src/nanoj/pumpControl/java/sequentialProtocol/SequenceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,25 @@ public void run(){
}
} else suckDuration = 0;

long startTime = System.currentTimeMillis() / 1000;
suckDuration *= 1000;

while ((System.currentTimeMillis() / 1000 - startTime) < suckDuration) {
long startTime = System.currentTimeMillis();

while ((System.currentTimeMillis() - startTime) < suckDuration) {
//Stop sequence if the "Stop" button was pressed.
if (!started) break;

//Calculate how much time there is still to go in seconds.
float timeToGo = (suckDuration - (float) (System.currentTimeMillis() / 1000 - startTime));
if (timeToGo < 60) setWaitingMessage("Withdrawal step. Waiting for: " + timeToGo + " seconds.");
else if (timeToGo >= 60) setWaitingMessage("Withdrawal step. Waiting for: "
+ timeToGo / 60 + " more minutes.");
float timeToGo = (suckDuration - (float) (System.currentTimeMillis() - startTime));

String formattedTime = format.format(new Date((long) timeToGo));

if (timeToGo > 60000)
setWaitingMessage("Withdrawal step. Waiting for: " + formattedTime);
else
setWaitingMessage("Withdrawal step. Waiting for: " +
Math.round(timeToGo/1000) + " seconds");

try {
Thread.sleep(300);
} catch (InterruptedException e) {
Expand Down

0 comments on commit cb14f92

Please sign in to comment.