nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

[BUG] NuttX on SIM is not list date info to /dev/rtc0

Open acassis opened this issue 4 months ago • 2 comments

Description / Steps to reproduce the issue

There is a strange BUG in the date support, for some reason it is not showing the date to rtc0

nsh> ls -l /dev
/dev:
 crw-------           0 2026-07-22 15:25 console
 crw-------           0 2026-07-22 15:25 gpio0
 crw-------           0 2026-07-22 15:25 gpio1
 crw-------           0 2026-07-22 15:25 gpio2
 crw-------           0 2026-07-22 15:25 gpio3
 crw-------           0 2026-07-22 15:25 loop
 crw-rw-rw-           0 2026-07-22 15:25 null
 crw-------           0 2026-07-22 15:25 oneshot
 b---------     1048576 2026-07-22 15:25 ram0
 b---------        1024 2026-07-22 15:25 ram1
 b---------      524288 2026-07-22 15:25 ram2
 crw-------           0 rtc0
 crw-rw-rw-           0 2026-07-22 15:25 zero

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu 24.04

NuttX Version

mainline

Issue Architecture

[Arch: all]

Issue Area

[Area: File System]

Host information

No response

Verification

  • [x] I have verified before submitting the report.

acassis avatar Jul 22 '26 15:07 acassis

@acassis I reproduced this locally, and it looks like /dev/rtc0 is registered before clock_inittime() runs, so its inode ends up with a zero timestamp also nsh only prints the timestamp when st_mtime != 0, which seems to explain why the date is missing. fix should be on the kernel side so the inode gets a valid timestamp rather than changing nsh. One possible approach could be to ensure the inode is timestamped after the clock has been synchronized, but but I'm not sure which approach would be preferred.

ML-dev-crypto avatar Jul 22 '26 16:07 ML-dev-crypto

@xiaoxiang781216 @raiden00pl for visibility

acassis avatar Jul 22 '26 18:07 acassis