casaroli opened a new pull request, #20560:
URL: https://github.com/apache/nuttx/pull/20560

   ## Summary
   
   Without `CONFIG_LIBC_LOCALTIME`, `gmtime_r()` (and `localtime_r()`, which 
uses it) set `tm_zone` to NULL. Programs print `tm_zone` as the time zone name, 
for example `strftime()` implementations that format `%Z` from it, and call 
`strlen()` on it, which faults.
   
   This PR sets it to `"UTC"`, as the time zone code of `CONFIG_LIBC_LOCALTIME` 
does for UTC.
   
   ## Impact
   
   Builds without `CONFIG_LIBC_LOCALTIME`: `tm_zone` is `"UTC"` instead of NULL.
   
   ## Testing
   
   `qemu-armv8a:knsh` with a virtio 9P share mounted at `/mnt`, QEMU 11. The 
test program was built outside the tree against the export package.
   
   Before:
   ```
   gmtime_r: tm_zone = NULL
   localtime_r: tm_zone = NULL
   ```
   
   After:
   ```
   gmtime_r: tm_zone = UTC
   localtime_r: tm_zone = UTC
   ```
   
   Builds with `-Wno-cpp -Werror`: `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`, 
`mps2-an500:nsh`, `rv-virt:knsh`, `raspberrypi-pico:nsh`. `tools/checkpatch.sh 
-c -u -m -g` passes.
   


-- 
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