Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added age in network menu
orbiter0054d3b1a6a2
diff --git a/htroot/Network.html b/htroot/Network.htmlindex 95011abe1..9f8f4aa8c 100644--- a/htroot/Network.html+++ b/htroot/Network.html@@ -43,6 +43,7 @@#(complete)#::<td class="small"><b>Address</b><br> </td><td class="small"><b>Hash</b><br> </td>+<td class="small"><b>Age</b><br> </td>#(/complete)#<td class="small"><b>Type</b><br> </td><td class="small"><b>Release/<br>SVN</b><br> </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>#[hash]#</td>+<td class=small>#[age]#</td>#(/complete)#<td class="small">#(type)#junior::senior::<a href="#[url]#" class="small">principal</a>#(/type)#</td><td class="small" align="right">#[version]#</td>diff --git a/htroot/Network.java b/htroot/Network.javaindex e8fa4b2c7..f2888ae0d 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -293,8 +293,6 @@ public class Network {links = Long.parseLong(seed.get("LCount", "0"));words = Long.parseLong(seed.get("ICount", "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");if (shortname.length() > 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_port", seed.get("Port", "-") );prop.put(STR_TABLE_LIST+conCount+"_complete_hash", seed.hash);+ prop.put(STR_TABLE_LIST+conCount+"_complete_age", seed.getAge());}else{prop.put(STR_TABLE_LIST+conCount+"_complete", 0);}diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.javaindex 0412836a6..d202f4e67 100644--- a/source/de/anomic/yacy/yacySeed.java+++ b/source/de/anomic/yacy/yacySeed.java@@ -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() {// if we set a last seen time, then we need to respect the seeds UTC offsetput("LastSeen", yacyCore.shortFormatter.format(new Date(System.currentTimeMillis() - serverDate.UTCDiff() + getUTCDiff())));