Skip to content

!sched: drop CONFIG_SYSTEM_TIME64 / CONFIG_HAVE_LONG_LONG / CONFIG_LIBC_LONG_LONG and sclock_t#3468

Open
xiaoxiang781216 wants to merge 4 commits intoapache:masterfrom
xiaoxiang781216:sched/remove-system-time64
Open

!sched: drop CONFIG_SYSTEM_TIME64 / CONFIG_HAVE_LONG_LONG / CONFIG_LIBC_LONG_LONG and sclock_t#3468
xiaoxiang781216 wants to merge 4 commits intoapache:masterfrom
xiaoxiang781216:sched/remove-system-time64

Conversation

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

@xiaoxiang781216 xiaoxiang781216 commented May 3, 2026

Summary

Companion to apache/nuttx#18840. The NuttX core now unconditionally
uses 64-bit time_t/clock_t, drops CONFIG_SYSTEM_TIME64,
CONFIG_HAVE_LONG_LONG and CONFIG_LIBC_LONG_LONG, and removes the
sclock_t alias. This PR aligns nuttx-apps with those changes:
purges the obsolete #ifdefs, the Kconfig dependencies, and the
sclock_t references.

Changes

apps: drop CONFIG_SYSTEM_TIME64 conditionals

  • examples/dronecan: drop SYSTEM_TIME64 Kconfig dependency.
  • examples/netlink_route: always use PRIx64 for nb->ne_time.
  • netutils/netinit: always use the one-hour LONG_TIME_SEC value.
  • netutils/ptpd: always pack the upper 16 bits of the 48-bit PTP
    seconds field, and always apply the 64-bit overflow guard in
    timespec_delta_ns().
  • testing/ostest/semtimed: always validate tv_sec >= 0.

compiler: drop CONFIG_HAVE_LONG_LONG and require long long support

  • Remove #ifdef CONFIG_HAVE_LONG_LONG guards in examples/noteprintf,
    examples/nxscope, fsutils/mkfatfs/configfat.c,
    logging/nxscope/nxscope_chan.c, netutils/ftpd,
    netutils/ntpclient, and testing/fs/fstest/fstest_main.c.
  • Drop the host stub macros for the obsolete config in
    system/zmodem/host/nuttx/compiler.h.

testing/ostest/wdog: replace sclock_t with clock_t

  • Mechanical rename of sclock_t -> clock_t in testing/ostest/wdog.c,
    netutils/thttpd (libhttpd.c, tdate_parse.c), and
    testing/testsuites/kernel/syscall/cases (fsync_test.c,
    time_test.c). No behavioural change.

testing/libc/scanftest: drop CONFIG_LIBC_LONG_LONG from help text

  • Remove the now-obsolete CONFIG_LIBC_LONG_LONG mention from the
    TESTING_SCANFTEST Kconfig help (companion to
    libs/libc/stdio/Kconfig removing the option).

Testing

tools/checkpatch.sh -f clean on all 19 changed files.

Built and ran ostest on both sim:nsh (host x86_64) and
rv-virt:nsh64 (qemu-system-riscv64), against the matching nuttx PR
apache/nuttx#18840. All tests including wdog_test pass.

sim:nsh

NuttShell (NSH) NuttX-12.0.0
nsh> ostest
ostest_main: Started user_main at PID=6
user_main: Begin argument test
...
user_main: timed mutex test
mutex_test: PASSED
user_main: cancel test
user_main: robust test
user_main: semaphore test
user_main: timed semaphore test
user_main: condition variable test
user_main: pthread_exit() test
user_main: pthread_rwlock test
user_main: pthread_rwlock_cancel test
user_main: timed wait test
user_main: timed message queue test
user_main: sigprocmask test
user_main: message queue test
user_main: signal handler test
user_main: nested signal handler test
user_main: POSIX timer test
user_main: spinlock test
user_main: wdog test
wdog_test start...
wdog_test end...
user_main: barrier test
user_main: setjmp test
user_main: scheduler lock test
sched_lock: PASSED No pre-emption occurred while scheduler was locked.
sched_lock: PASSED No pre-emption occurred while scheduler was locked.
user_main: nxevent test
user_main: Exiting
ostest_main: Exiting with status 0

rv-virt:nsh64

NuttShell (NSH) NuttX-12.0.0
nsh> ostest
...
wdog_test start...
wdog_test end...
ostest_main: Exiting with status 0

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking change request here for testing

@xiaoxiang781216 xiaoxiang781216 force-pushed the sched/remove-system-time64 branch from fbb77e3 to 1f33dfd Compare May 3, 2026 13:09
@xiaoxiang781216 xiaoxiang781216 changed the title remove CONFIG_SYSTEM_TIME64 references and always assume 64-bit time sched: drop CONFIG_SYSTEM_TIME64 / CONFIG_HAVE_LONG_LONG / CONFIG_LIBC_LONG_LONG and sclock_t May 3, 2026
@xiaoxiang781216 xiaoxiang781216 force-pushed the sched/remove-system-time64 branch from 1f33dfd to 2bfddba Compare May 3, 2026 13:15
@xiaoxiang781216 xiaoxiang781216 force-pushed the sched/remove-system-time64 branch 2 times, most recently from e91a84a to 677d340 Compare May 3, 2026 15:00
@xiaoxiang781216
Copy link
Copy Markdown
Contributor Author

Marking change request here for testing

update with the test and log.

@linguini1 linguini1 dismissed their stale review May 3, 2026 15:03

Tests provided; although maybe others can help test some of the other changed apps/on smaller devices.

@cederom
Copy link
Copy Markdown
Contributor

cederom commented May 3, 2026

Thank you @xiaoxiang781216, I am for this change, please lets mark it with ! in the PR title and git commits so it attracts attention when reading logs, also we should announce this on mailing list, I remember we had this discussion before and this may be good time for this change :-)

@cederom cederom requested review from acassis and yamt May 3, 2026 15:33
@xiaoxiang781216 xiaoxiang781216 force-pushed the sched/remove-system-time64 branch from 677d340 to 2bc1a0c Compare May 3, 2026 16:34
@xiaoxiang781216 xiaoxiang781216 added the breaking change This change requires a mitigation entry in the release notes. label May 3, 2026
@xiaoxiang781216 xiaoxiang781216 changed the title sched: drop CONFIG_SYSTEM_TIME64 / CONFIG_HAVE_LONG_LONG / CONFIG_LIBC_LONG_LONG and sclock_t !sched: drop CONFIG_SYSTEM_TIME64 / CONFIG_HAVE_LONG_LONG / CONFIG_LIBC_LONG_LONG and sclock_t May 3, 2026
@github-actions github-actions Bot removed the breaking change This change requires a mitigation entry in the release notes. label May 3, 2026
@xiaoxiang781216
Copy link
Copy Markdown
Contributor Author

Thank you @xiaoxiang781216, I am for this change, please lets mark it with ! in the PR title and git commits so it attracts attention when reading logs, also we should announce this on mailing list, I remember we had this discussion before and this may be good time for this change :-)

Done.

The matching nuttx commit removes CONFIG_HAVE_LONG_LONG; clean up the
remaining users in nuttx-apps so that "long long" is always assumed:

  - examples/noteprintf, examples/nxscope:
        unconditionally exercise the %lld / long long branch.
  - fsutils/mkfatfs/configfat.c:
        drop the 32-bit fall-back paths in mkfatfs_nfatsect12/16/32;
        always use uint64_t for the FAT-size arithmetic.
  - logging/nxscope/nxscope_chan.c:
        drop the CONFIG_HAVE_LONG_LONG guard around the 64-bit
        sample helpers.
  - netutils/ftpd, netutils/ntpclient:
        always emit the 64-bit format strings.
  - testing/fs/fstest/fstest_main.c:
        drop the parallel 32-bit verification path; keep only the
        64-bit (long long) random pattern generator.
  - system/zmodem/host/nuttx/compiler.h:
        remove the host-side CONFIG_HAVE_LONG_LONG stub macro.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
CONFIG_LIBC_LONG_LONG has been removed; long long support is now
unconditional.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
NuttX always uses a 64-bit system clock now (time_t/clock_t are
always 64-bit). Remove the obsolete CONFIG_SYSTEM_TIME64 #ifdef
branches and Kconfig dependency.

  - examples/dronecan: drop SYSTEM_TIME64 dependency
  - examples/netlink_route: always use PRIx64
  - netutils/netinit: always use the 1-hour LONG_TIME_SEC
  - netutils/ptpd: always pack the 48-bit seconds field and apply
    the 64-bit overflow guard in timespec_delta_ns()
  - testing/ostest/semtimed: always validate tv_sec >= 0

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
…casts

Align with the upstream nuttx change that drops the sclock_t alias now
that clock_t is itself a signed 64-bit type (int64_t).  Beyond the pure
sclock_t -> clock_t rename, this commit also removes the
now-unnecessary (time_t)-1 / (time_t)0 / (off_t)-1 casts that were
papering over the previously-unsigned time_t.

Files touched:

  - examples/alarm/alarm_main.c:        sclock_t -> clock_t
  - netutils/dhcpd/dhcpd.c:             sclock_t -> clock_t
  - netutils/ftpd/ftpd.c:               sclock_t -> clock_t
  - netutils/thttpd/libhttpd.c,
    netutils/thttpd/tdate_parse.c:      drop (time_t)-1 / (time_t)0 /
                                        (off_t)-1 sentinel casts
  - system/resmonitor/filldisk.c,
    system/zmodem/zm_receive.c:         sclock_t -> clock_t
  - testing/ostest/wdog.c:              sclock_t -> clock_t (the bulk
                                        of the rename, 30 sites)
  - testing/testsuites/kernel/syscall/cases/{clock_nanosleep_test,
    fsync_test,time_test}.c:            drop (time_t)-1 casts in the
                                        new signed-time_t world

No behavioural change.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
@xiaoxiang781216 xiaoxiang781216 force-pushed the sched/remove-system-time64 branch from 2bc1a0c to 18c4678 Compare May 5, 2026 17:56
Copy link
Copy Markdown
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @xiaoxiang781216 :-)

Copy link
Copy Markdown
Member

@lupyuen lupyuen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested OK on Arm64 + RISC-V 64-bit SBCs: Avaota-A1, StarPro64, Oz64. Thanks :-)

$ git clone https://github.com/xiaoxiang781216/incubator-nuttx nuttx --branch sched/remove-system-time64
HEAD is now at 9d4ea3aa21 arch/esp32: Fix conflicting types for '_times_r'
$ git clone https://github.com/xiaoxiang781216/incubator-nuttx-apps apps --branch sched/remove-system-time64
HEAD is now at 18c467857 !apps: replace sclock_t with clock_t and drop redundant time_t/off_t casts
...
nsh> uname -a
NuttX 3.6.1 9d4ea3aa21 May  6 2026 10:28:57 ...
nsh> ostest
ostest_main: Exiting with status 0

@lupyuen
Copy link
Copy Markdown
Member

lupyuen commented May 6, 2026

I suggest we wait first for these to be merged, otherwise we might have nuttx vs nuttx-apps conflicts:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants