Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
0547bdab
Commit
0547bdab
authored
May 30, 2018
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve stringify function.
parent
b338ccaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
db/Reservation.pm.in
db/Reservation.pm.in
+12
-6
No files found.
db/Reservation.pm.in
View file @
0547bdab
...
...
@@ -40,6 +40,7 @@ use Project;
use
User
;
use
Experiment
;
use
NodeType
;
use
POSIX
qw
(
strftime
);
use
overload
(
'""'
=>
'Stringify'
);
#
Configure
variables
...
...
@@ -242,7 +243,10 @@ sub uuid($) { return $_[0]->{"UUID"}; }
sub
Stringify
($)
{
my
($
self
)
=
@
_
;
my
$
idx
=
$
self
->
idx
();
$
idx
=
"xxx"
if
(
!defined($idx));
my
$
uid
=
$
self
->
uid
();
my
$
pid
=
$
self
->
pid
();
$
pid
=
"(free)"
if
(
!defined( $pid ) );
...
...
@@ -251,11 +255,13 @@ sub Stringify($)
}
my
$
nodes
=
$
self
->
nodes
();
my
$
type
=
$
self
->
type
();
my
$
start
=
defined
(
$
self
->
start
()
)
?
localtime
(
$
self
->
start
()
)
:
"epoch"
;
my
$
end
=
defined
(
$
self
->
end
()
)
?
localtime
(
$
self
->
end
()
)
:
"forever"
;
return
"[Reservation: $pid, ${nodes}x${type}, ${start}-${end}]"
;
my
$
start
=
(
defined
(
$
self
->
start
()
)
?
POSIX
::
strftime
(
"%m/%d/20%y %H:%M:%S"
,
localtime
($
self
->
start
()))
:
"epoch"
);
my
$
end
=
(
defined
(
$
self
->
end
()
)
?
POSIX
::
strftime
(
"%m/%d/20%y %H:%M:%S"
,
localtime
($
self
->
end
()))
:
"forever"
);
return
"[Reservation:$idx $pid/$uid, ${nodes}x${type}, ${start}-${end}]"
;
}
sub
SetStart
($$)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment