Commit 0cc36774 authored by Mac Newbold's avatar Mac Newbold

Small fix to swap requests: if it has been more than 24 hours, calculate

the number of hours correctly. (Was using idlehours mod 24.)
parent 7f0fe4d5
...@@ -1546,7 +1546,7 @@ function TBGetExptIdleTime($pid, $eid, $format = 0) { ...@@ -1546,7 +1546,7 @@ function TBGetExptIdleTime($pid, $eid, $format = 0) {
if (!$format) { if (!$format) {
$t = round($t/3600,2); $t = round($t/3600,2);
} else { } else {
$t = date($format,mktime(0,0,$t)); $t = date($format,mktime(0,0,$t,1,1));
} }
return $t; return $t;
} }
......
...@@ -81,19 +81,19 @@ $r=mysql_fetch_array($q); ...@@ -81,19 +81,19 @@ $r=mysql_fetch_array($q);
$c=$r["c"]; $c=$r["c"];
if (!$confirmed) { if (!$confirmed) {
echo "<center><h3><br> echo "<center><h3>
Expt. '$eid' in project '$pid' has $c Emulab node".($c!=1?"s":""). Expt. '$eid' in project '$pid' has $c Emulab node".($c!=1?"s":"").
" reserved,<br>and has been sent $swap_requests swap request". " reserved,<br>\nand has been sent $swap_requests swap request".
($swap_requests!=1?"s":"")." since it went idle.<br>"; ($swap_requests!=1?"s":"")." since it went idle.<br>\n";
if ($swap_requests > 0) { if ($swap_requests > 0) {
echo "The most recent one was sent at $last_swap_req.<br>"; echo "The most recent one was sent at $last_swap_req.<br>\n";
} }
if ($swap_requests >= $tell_proj_head) { if ($swap_requests >= $tell_proj_head) {
echo "This notification will also be sent to the project leader.<br>"; echo "This notification will also be sent to the project leader.\n";
} }
echo "<p> echo "<p>
Are you sure you want to send an email message requesting that<br> Are you sure you want to send an email message requesting that
experiment '$eid' be swapped or terminated? experiment '$eid' be swapped or terminated?</p>
</h3>\n"; </h3>\n";
# #
...@@ -134,9 +134,16 @@ if (! $leaders) { ...@@ -134,9 +134,16 @@ if (! $leaders) {
} }
$lastact = TBGetExptLastAct($pid,$eid); $lastact = TBGetExptLastAct($pid,$eid);
$idletime= TBGetExptIdleTime($pid,$eid,"G:i"); $idletime= TBGetExptIdleTime($pid,$eid,"j:G:i");
$idletime = str_replace(":0",":",$idletime); $idletime = str_replace(":0",":",$idletime);
list($idlehrs,$idlemin) = explode(":",$idletime); list($idledays,$idlehrs,$idlemin) = explode(":",$idletime);
#print "<pre>idletime=$idletime\nidledays=$idledays\nidlehrs=$idlehrs\n</pre>";
$idledays -= 1; # Measured from the first of the month...
#print "<pre>\nidledays=$idledays\nidlehrs=$idlehrs\n</pre>";
$idlehrs += 24*$idledays;
#print "<pre>\nidledays=$idledays\nidlehrs=$idlehrs\n</pre>";
$msg = $msg =
"Hi, this is an important automated message from $THISHOMEBASE.\n\n". "Hi, this is an important automated message from $THISHOMEBASE.\n\n".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment