aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/port-state.pl
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2015-04-15 19:28:49 +0200
committerKristian Lyngstol <kristian@bohemians.org>2015-04-15 19:28:49 +0200
commitc04b0c889cc434d5700dbc172a9aa1017d708f6b (patch)
tree016fdf3b510b71b6d47e8a99b0db7bbbf34630ef /web/nms.gathering.org/port-state.pl
parent7fa5018f5946aa7d4a7775fe3347825d965b061d (diff)
NMS: Output streamlining for time
Now displays time as shown in the database (don't want to use nms.now, since that might not reflect the actual data). This does have one flaw: Ping time is a separate request, so technically there could be a miss-match there. Also fix the padding-issue with time display. (E.g.: 17:5:5 17:50:5 17:5:50 17:50:50 7:51:15 17:15:51 etc.
Diffstat (limited to 'web/nms.gathering.org/port-state.pl')
-rwxr-xr-xweb/nms.gathering.org/port-state.pl4
1 files changed, 4 insertions, 0 deletions
diff --git a/web/nms.gathering.org/port-state.pl b/web/nms.gathering.org/port-state.pl
index 76dd7d8..014486b 100755
--- a/web/nms.gathering.org/port-state.pl
+++ b/web/nms.gathering.org/port-state.pl
@@ -70,5 +70,9 @@ while (my $ref = $q4->fetchrow_hashref()) {
# push @{$json{'linknets'}}, $ref;
}
+my $q5 = $dbh->prepare ('select ' . $now . ' as time;');
+$q5->execute();
+$json{'time'} = $q5->fetchrow_hashref()->{'time'};
+
print $cgi->header(-type=>'text/json; charset=utf-8');
print JSON::XS::encode_json(\%json);