Description
When we run "hdfs dfs -ls" or "hdfs dfs -stat" on the same file/directory, the time of results are different.
Like this:
>> $ ./hdfs dfs -stat /user/xxx/collie-pt-canary
>> 2018-12-10 10:04:57
>> ./hdfs dfs -ls /user/xxx/collie-pt-canary
>> rw-rr- 3 xxx supergroup 0 2018-12-10 18:04
Strangely, we found the time is different(8 hours). The stat command uses UTC timezone, but the Ls command uses system local timezone.
Why does the stat command use UTC timezone, but Ls not?
// in Stat.java timeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); timeFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
By the way, in Unix/Linux the ls and stat return the same time on display.
Should we unify the timezone?