1515// specific language governing permissions and limitations
1616// under the License.
1717
18+ use chrono:: { DateTime , TimeZone , Utc } ;
1819use hdfs_native:: client:: { FileStatus , ListStatusIterator } ;
1920
2021use crate :: raw:: oio:: Entry ;
@@ -38,7 +39,7 @@ impl HdfsNativeLister {
3839
3940impl oio:: List for HdfsNativeLister {
4041 async fn next ( & mut self ) -> Result < Option < Entry > > {
41- let de: FileStatus = match self . lsi . next ( ) {
42+ let de: FileStatus = match self . lsi . next ( ) . await {
4243 Some ( res) => match res {
4344 Ok ( fs) => fs,
4445 Err ( e) => return Err ( parse_hdfs_error ( e) ) ,
@@ -49,9 +50,19 @@ impl oio::List for HdfsNativeLister {
4950 let path = build_rel_path ( & self . root , & de. path ) ;
5051
5152 let entry = if !de. isdir {
53+ let odt = DateTime :: from_timestamp ( de. modification_time as i64 , 0 ) ;
54+ let dt = match odt {
55+ Some ( dt) => dt,
56+ None => {
57+ return Err ( Error :: new (
58+ ErrorKind :: Unexpected ,
59+ & format ! ( "Failure in extracting modified_time for {}" , path) ,
60+ ) )
61+ }
62+ } ;
5263 let meta = Metadata :: new ( EntryMode :: FILE )
5364 . with_content_length ( de. length as u64 )
54- . with_last_modified ( de . modification_time . into ( ) ) ;
65+ . with_last_modified ( dt ) ;
5566 oio:: Entry :: new ( & path, meta)
5667 } else if de. isdir {
5768 // Make sure we are returning the correct path.
0 commit comments