Use millis for joda DateTimeFormatter.print()

Fixes #4782.
This commit is contained in:
Andrew Raines 2014-01-17 08:13:51 -06:00
parent 1fba68a634
commit 3f14725057
2 changed files with 6 additions and 4 deletions

View File

@ -39,6 +39,7 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.rest.RestRequest.Method.GET;
@ -109,9 +110,9 @@ public class RestCountAction extends AbstractCatAction {
private Table buildTable(RestRequest request, CountResponse response) {
Table table = getTableWithHeader(request);
long time = System.currentTimeMillis() / 1000;
long time = System.currentTimeMillis();
table.startRow();
table.addCell(time);
table.addCell(TimeUnit.SECONDS.convert(time, TimeUnit.MILLISECONDS));
table.addCell(dateFormat.print(time));
table.addCell(response.getCount());
table.endRow();

View File

@ -36,6 +36,7 @@ import org.joda.time.format.DateTimeFormatter;
import java.io.IOException;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.rest.RestRequest.Method.GET;
@ -100,10 +101,10 @@ public class RestHealthAction extends AbstractCatAction {
private DateTimeFormatter dateFormat = DateTimeFormat.forPattern("HH:mm:ss");
private Table buildTable(final ClusterHealthResponse health, final RestRequest request) {
long time = System.currentTimeMillis() / 1000;
long time = System.currentTimeMillis();
Table t = getTableWithHeader(request);
t.startRow();
t.addCell(time);
t.addCell(TimeUnit.SECONDS.convert(time, TimeUnit.MILLISECONDS));
t.addCell(dateFormat.print(time));
t.addCell(health.getClusterName());
t.addCell(health.getStatus().name().toLowerCase(Locale.ROOT));