YARN-570. Time strings are formated in different timezone. (Akira Ajisaka and Peng Zhang via kasha)
This commit is contained in:
parent
99d9d0c2d1
commit
456b973819
|
@ -65,6 +65,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
YARN-2735. diskUtilizationPercentageCutoff and diskUtilizationSpaceCutoff
|
YARN-2735. diskUtilizationPercentageCutoff and diskUtilizationSpaceCutoff
|
||||||
are initialized twice in DirectoryCollection. (Zhihai Xu via kasha)
|
are initialized twice in DirectoryCollection. (Zhihai Xu via kasha)
|
||||||
|
|
||||||
|
YARN-570. Time strings are formated in different timezone.
|
||||||
|
(Akira Ajisaka and Peng Zhang via kasha)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -29,10 +29,11 @@ import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
public class Times {
|
public class Times {
|
||||||
private static final Log LOG = LogFactory.getLog(Times.class);
|
private static final Log LOG = LogFactory.getLog(Times.class);
|
||||||
|
|
||||||
|
// This format should match the one used in yarn.dt.plugins.js
|
||||||
static final ThreadLocal<SimpleDateFormat> dateFormat =
|
static final ThreadLocal<SimpleDateFormat> dateFormat =
|
||||||
new ThreadLocal<SimpleDateFormat>() {
|
new ThreadLocal<SimpleDateFormat>() {
|
||||||
@Override protected SimpleDateFormat initialValue() {
|
@Override protected SimpleDateFormat initialValue() {
|
||||||
return new SimpleDateFormat("d-MMM-yyyy HH:mm:ss");
|
return new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,38 @@ function renderHadoopDate(data, type, full) {
|
||||||
if(data === '0'|| data === '-1') {
|
if(data === '0'|| data === '-1') {
|
||||||
return "N/A";
|
return "N/A";
|
||||||
}
|
}
|
||||||
return new Date(parseInt(data)).toUTCString();
|
var date = new Date(parseInt(data));
|
||||||
|
var monthList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||||
|
var weekdayList = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||||
|
var offsetMinutes = date.getTimezoneOffset();
|
||||||
|
var offset
|
||||||
|
if (offsetMinutes <= 0) {
|
||||||
|
offset = "+" + zeroPad(-offsetMinutes / 60 * 100, 4);
|
||||||
|
} else {
|
||||||
|
offset = "-" + zeroPad(offsetMinutes / 60 * 100, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// EEE MMM dd HH:mm:ss Z yyyy
|
||||||
|
return weekdayList[date.getDay()] + " " +
|
||||||
|
monthList[date.getMonth()] + " " +
|
||||||
|
date.getDate() + " " +
|
||||||
|
zeroPad(date.getHours(), 2) + ":" +
|
||||||
|
zeroPad(date.getMinutes(), 2) + ":" +
|
||||||
|
zeroPad(date.getSeconds(), 2) + " " +
|
||||||
|
offset + " " +
|
||||||
|
date.getFullYear();
|
||||||
}
|
}
|
||||||
// 'sort', 'type' and undefined all just use the number
|
// 'sort', 'type' and undefined all just use the number
|
||||||
// If date is 0, then for purposes of sorting it should be consider max_int
|
// If date is 0, then for purposes of sorting it should be consider max_int
|
||||||
return data === '0' ? '9007199254740992' : data;
|
return data === '0' ? '9007199254740992' : data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function zeroPad(n, width) {
|
||||||
|
n = n + '';
|
||||||
|
return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
|
||||||
|
}
|
||||||
|
|
||||||
function renderHadoopElapsedTime(data, type, full) {
|
function renderHadoopElapsedTime(data, type, full) {
|
||||||
if (type === 'display' || type === 'filter') {
|
if (type === 'display' || type === 'filter') {
|
||||||
var timeDiff = parseInt(data);
|
var timeDiff = parseInt(data);
|
||||||
|
|
Loading…
Reference in New Issue