added age in network menu

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@809 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 3dd7e90cdd
commit 0054d3b1a6

@ -43,6 +43,7 @@
#(complete)#:: #(complete)#::
<td class="small"><b>Address</b><br>&nbsp;</td> <td class="small"><b>Address</b><br>&nbsp;</td>
<td class="small"><b>Hash</b><br>&nbsp;</td> <td class="small"><b>Hash</b><br>&nbsp;</td>
<td class="small"><b>Age</b><br>&nbsp;</td>
#(/complete)# #(/complete)#
<td class="small"><b>Type</b><br>&nbsp;</td> <td class="small"><b>Type</b><br>&nbsp;</td>
<td class="small"><b>Release/<br>SVN</b><br>&nbsp;</td> <td class="small"><b>Release/<br>SVN</b><br>&nbsp;</td>
@ -71,6 +72,7 @@
:: ::
<td class="small"><a href="http://#[ip]#:#[port]#/Network.html?page=1&ip=" class="small">http://#[ip]#:#[port]#</a></td> <td class="small"><a href="http://#[ip]#:#[port]#/Network.html?page=1&ip=" class="small">http://#[ip]#:#[port]#</a></td>
<td class=small>#[hash]#</td> <td class=small>#[hash]#</td>
<td class=small>#[age]#</td>
#(/complete)# #(/complete)#
<td class="small">#(type)#junior::senior::<a href="#[url]#" class="small">principal</a>#(/type)#</td> <td class="small">#(type)#junior::senior::<a href="#[url]#" class="small">principal</a>#(/type)#</td>
<td class="small" align="right">#[version]#</td> <td class="small" align="right">#[version]#</td>

@ -293,8 +293,6 @@ public class Network {
links = Long.parseLong(seed.get("LCount", "0")); links = Long.parseLong(seed.get("LCount", "0"));
words = Long.parseLong(seed.get("ICount", "0")); words = Long.parseLong(seed.get("ICount", "0"));
} catch (Exception exc) {links = 0; words = 0;} } catch (Exception exc) {links = 0; words = 0;}
prop.put(STR_TABLE_LIST+conCount+"_complete", ((complete)? 1 : 0) );
prop.put(STR_TABLE_LIST+conCount+"_hash", seed.hash);
String shortname = seed.get("Name", "deadlink"); String shortname = seed.get("Name", "deadlink");
if (shortname.length() > 20) { if (shortname.length() > 20) {
shortname = shortname.substring(0, 20) + "..."; shortname = shortname.substring(0, 20) + "...";
@ -306,6 +304,7 @@ public class Network {
prop.put(STR_TABLE_LIST+conCount+"_complete_ip", seed.get("IP", "-") ); prop.put(STR_TABLE_LIST+conCount+"_complete_ip", seed.get("IP", "-") );
prop.put(STR_TABLE_LIST+conCount+"_complete_port", seed.get("Port", "-") ); prop.put(STR_TABLE_LIST+conCount+"_complete_port", seed.get("Port", "-") );
prop.put(STR_TABLE_LIST+conCount+"_complete_hash", seed.hash); prop.put(STR_TABLE_LIST+conCount+"_complete_hash", seed.hash);
prop.put(STR_TABLE_LIST+conCount+"_complete_age", seed.getAge());
}else{ }else{
prop.put(STR_TABLE_LIST+conCount+"_complete", 0); prop.put(STR_TABLE_LIST+conCount+"_complete", 0);
} }

@ -245,6 +245,18 @@ public class yacySeed {
} }
} }
public int getAge() {
// returns the age as number of days
try {
long t = yacyCore.shortFormatter.parse(get("BDate", "20040101000000")).getTime();
return (int) ((System.currentTimeMillis() - (t - getUTCDiff() + serverDate.UTCDiff())) / 1000 / 60 / 60 / 24);
} catch (java.text.ParseException e) {
return -1;
} catch (java.lang.NumberFormatException e) {
return -1;
}
}
public void setLastSeenTime() { public void setLastSeenTime() {
// if we set a last seen time, then we need to respect the seeds UTC offset // if we set a last seen time, then we need to respect the seeds UTC offset
put("LastSeen", yacyCore.shortFormatter.format(new Date(System.currentTimeMillis() - serverDate.UTCDiff() + getUTCDiff()))); put("LastSeen", yacyCore.shortFormatter.format(new Date(System.currentTimeMillis() - serverDate.UTCDiff() + getUTCDiff())));

Loading…
Cancel
Save