在实时图上匹配时间

matching time on real-time graph

我在我的实时图表中设置了 time/date 作为 x 值,但是时间与我的 android 的时间不匹配,谁能检查我的代码

final DateFormat sdf = android.text.format.DateFormat.getTimeFormat(this);
    graph.getGridLabelRenderer().setLabelFormatter(new DefaultLabelFormatter() {
        @Override
        public String formatLabel(double value, boolean isValueX) {
            if (isValueX) {
                long Valuemilis = (new Double(value)).longValue();
                return sdf.format(Valuemilis*1000);
            }
            else {
                return null;
            }
        }
    });

app's picture

要获取以毫秒为单位的系统时间,您可以使用 Date.java class。 下面的代码片段可能会解决您的问题。

long Valuemilis = new Date().getTime();