You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Fred Peng (JIRA)" <ji...@apache.org> on 2018/12/11 10:38:00 UTC

[jira] [Created] (HDFS-14139) FsShell ls and stat command return different Modification Time on display.

Fred Peng created HDFS-14139:
--------------------------------

             Summary: FsShell ls and stat command return different Modification Time on display.
                 Key: HDFS-14139
                 URL: https://issues.apache.org/jira/browse/HDFS-14139
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: fs, shell
            Reporter: Fred Peng


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-r--r-- 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?
{code:java}
// in Stat.java
timeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
timeFmt.setTimeZone(TimeZone.getTimeZone("UTC"));{code}
By the way, in Unix/Linux the ls and stat return the same time on display.
Should we unify the timezone?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org