Changeset 20876ff for apps


Ignore:
Timestamp:
Dec 17, 2018 2:43:02 PM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
8a06027
Parents:
bf3a7d6
Message:

Sybil page date formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java

    rbf3a7d6 r20876ff  
    66import java.math.BigInteger;
    77import java.text.Collator;
     8import java.text.DateFormat;
    89import java.text.DecimalFormat;
    910import java.util.ArrayList;
     
    4647import net.i2p.util.Log;
    4748import net.i2p.util.ObjectCounter;
     49import net.i2p.util.SystemVersion;
    4850import net.i2p.util.Translate;
    4951import net.i2p.util.VersionComparator;
     
    226228                       "<select name=\"date\">\n");
    227229            boolean first = true;
     230            DateFormat dfmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
     231            dfmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    228232            for (Long date : dates) {
    229233                buf.append("<option value=\"").append(date).append('\"');
     
    232236                    first = false;
    233237                }
    234                 buf.append('>').append(new Date(date.longValue())).append("</option>\n");
     238                buf.append('>').append(dfmt.format(new Date(date.longValue()))).append("</option>\n");
    235239            }       
    236240            buf.append("</select>\n" +
     
    248252        renderRouterInfo(buf, _context.router().getRouterInfo(), null, true, false);
    249253        buf.append("<h3 id=\"known\" class=\"sybils\">Known Floodfills: ").append(ris.size()).append("</h3>");
     254        DateFormat dfmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
     255        dfmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
    250256        buf.append("<div id=\"sybils_summary\">\n" +
    251257                   "<b>Average closest floodfill distance:</b> ").append(fmt.format(avgMinDist)).append("<br>\n" +
    252258                   "<b>Routing Data:</b> \"").append(DataHelper.getUTF8(_context.routerKeyGenerator().getModData()))
    253            .append("\" <b>Last Changed:</b> ").append(new Date(_context.routerKeyGenerator().getLastChanged())).append("<br>\n" +
     259           .append("\" <b>Last Changed:</b> ").append(dfmt.format(new Date(_context.routerKeyGenerator().getLastChanged()))).append("<br>\n" +
    254260                   "<b>Next Routing Data:</b> \"").append(DataHelper.getUTF8(_context.routerKeyGenerator().getNextModData()))
    255261           .append("\" <b>Rotates in:</b> ").append(DataHelper.formatDuration(_context.routerKeyGenerator().getTimeTillMidnight())).append("\n" +
     
    394400            Collections.sort(warns, new PointsComparator(points));
    395401            ReasonComparator rcomp = new ReasonComparator();
    396             buf.append("<h3 id=\"threats\" class=\"sybils\">Routers with Most Threat Points as of " + new Date(date) + "</h3>");
     402            DateFormat dfmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
     403            dfmt.setTimeZone(SystemVersion.getSystemTimeZone(_context));
     404            buf.append("<h3 id=\"threats\" class=\"sybils\">Routers with Most Threat Points as of " + dfmt.format(new Date(date)) + "</h3>");
    397405            for (Hash h : warns) {
    398406                RouterInfo ri = _context.netDb().lookupRouterInfoLocally(h);
     
    882890        prev = null;
    883891        final int limit = Math.min(10, sybils.size());
     892        DateFormat dfmt = DateFormat.getDateInstance(DateFormat.MEDIUM);
    884893        for (int i = start; i <= days; i++) {
    885             out.write("<h3 class=\"tabletitle\">Distance for " + new Date(now) +
     894            out.write("<h3 class=\"tabletitle\">Distance for " + dfmt.format(new Date(now)) +
    886895                      "</h3><table class=\"sybil_distance\"><tr><th>Hash<th>Distance<th>Distance from previous</tr>\n");
    887896            Hash rkey = rkgen.getRoutingKey(from, now);
Note: See TracChangeset for help on using the changeset viewer.