Biancaa-R opened a new pull request, #3406:
URL: https://github.com/apache/nuttx-apps/pull/3406

   Fixes the issue : https://github.com/apache/nuttx/issues/17063
   
   <img width="994" height="210" alt="image" 
src="https://github.com/user-attachments/assets/f6b659e6-1f73-4fa2-bf5a-20d9680b2b02";
 />
   
   
   a) modification aims to add human-readable timestamp reporting to the ls 
command by utilizing the struct stat information. 
   b) time_t st_mtime; / Time of last modification / from stat register to 
maintain time records.
   c) Epoch entries replaced by ---.
   d) ls -l (without options) implementation done here.
   
   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
     
   * So basically displaying the last modified time that is stored in the stat 
struct in ls -l command.
   * stat(fullpath, &buf): This fills the buf structure with metadata from the 
filesystem.
   *  buf.st_mtime: This specifically targets the "Last Modified" timestamp.
   * Safety Check: if (ret == 0 && buf.st_mtime > 0 ...) ensures that the stat 
call was successful and that the time value is valid before trying to process 
it.
    *  localtime_r(&t, &tm): This takes the Unix epoch time (seconds since 
1970) and breaks it down into a struct tm (years, months, days, etc.).
    *  Formatting: %04d-%02d-%02d, which outputs the ISO 8601 standard (e.g., 
2023-10-27).
   ## Impact
   
   Previously the ls -l didnt display the time of last modification , this is a 
small fix for more "linux like" experience.
   
   ## Testing
   
   * Apache NuttX Simulation Mode allows you to run the OS as a native Linux 
process.
   * Building and running it and executing the ls -l command in the shell.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to