accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject svn commit: r1461320 - in /accumulo/trunk: ./ assemble/ core/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/java/org/apache/accumulo/fate/zookeeper/ server/ server/src/main/java/org/apache/accumulo/server/monitor/servlets/ src/
Date Tue, 26 Mar 2013 21:25:44 GMT
Author: ctubbsii
Date: Tue Mar 26 21:25:44 2013
New Revision: 1461320

URL: http://svn.apache.org/r1461320
Log:
ACCUMULO-597 Merge changes to trunk

Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/assemble/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/examples/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java 
 (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1461266-1461317

Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/assemble:r1460921-1461104,1461106-1461110,1461112-1461246,1461248-1461258,1461260,1461262-1461317

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1461266-1461317

Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/examples:r1460921-1461104,1461106-1461110,1461112-1461246,1461248-1461258,1461260,1461262-1461317

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1460921-1461104,1461106-1461110,1461112-1461246,1461248-1461258,1461260,1461262-1461317

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1460921-1461104,1461106-1461110,1461112-1461246,1461248-1461258,1461260,1461262-1461317

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1461266-1461317

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java?rev=1461320&r1=1461319&r2=1461320&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
Tue Mar 26 21:25:44 2013
@@ -29,7 +29,10 @@ import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
+import java.util.TimeZone;
 
 import javax.servlet.ServletException;
 import javax.servlet.ServletOutputStream;
@@ -192,7 +195,7 @@ public class DefaultServlet extends Basi
         
         sb.append(sep);
         sep = ",";
-        sb.append("[" + point.getFirst() + "," + y + "]");
+        sb.append("[" + utc2local(point.getFirst()) + "," + y + "]");
       }
       sb.append("    ];\n");
     }
@@ -217,11 +220,28 @@ public class DefaultServlet extends Basi
       sb.append("data: d" + i + ", " + opts + ", color:\"" + colors[i] + "\" }");
     }
     sb.append("], ");
-    sb.append("{yaxis:{}, xaxis:{mode:\"time\",minTickSize: [1, \"minute\"],timeformat: \"%H:%M\",
ticks:3}});");
+    sb.append("{yaxis:{}, xaxis:{mode:\"time\",minTickSize: [1, \"minute\"],timeformat: \"%H:%M<br
/>" + getShortTZName() + "\", ticks:3}});");
     sb.append("   });\n");
     sb.append("</script>\n");
   }
   
+  /**
+   * Shows the current time zone (based on the current time) short name
+   */
+  private static String getShortTZName() {
+    TimeZone tz = TimeZone.getDefault();
+    return tz.getDisplayName(tz.inDaylightTime(new Date()), TimeZone.SHORT);
+  }
+  
+  /**
+   * Converts a unix timestamp in UTC to one that is relative to the local timezone
+   */
+  private static Long utc2local(Long utcMillis) {
+    Calendar currentCalendar = Calendar.getInstance(); // default timezone
+    currentCalendar.setTimeInMillis(utcMillis + currentCalendar.getTimeZone().getOffset(utcMillis));
+    return currentCalendar.getTime().getTime();
+  }
+  
   @Override
   protected void pageBody(HttpServletRequest req, HttpServletResponse resp, StringBuilder
sb) throws IOException {
     if (req.getRequestURI().equals("/docs") || req.getRequestURI().equals("/docs/apidocs"))
{

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/src:r1460921-1461104,1461106-1461110,1461112-1461246,1461248-1461258,1461260,1461262-1461317



Mime
View raw message