cosmopolitan/test/libc/calls
Justine Tunney dd8544c3bd
Delve into clock rabbit hole
The worst issue I had with consts.sh for clock_gettime is how it defined
too many clocks. So I looked into these clocks all day to figure out how
how they overlap in functionality. I discovered counter-intuitive things
such as how CLOCK_MONOTONIC should be CLOCK_UPTIME on MacOS and BSD, and
that CLOCK_BOOTTIME should be CLOCK_MONOTONIC on MacOS / BSD. Windows 10
also has some incredible new APIs, that let us simplify clock_gettime().

  - Linux CLOCK_REALTIME         -> GetSystemTimePreciseAsFileTime()
  - Linux CLOCK_MONOTONIC        -> QueryUnbiasedInterruptTimePrecise()
  - Linux CLOCK_MONOTONIC_RAW    -> QueryUnbiasedInterruptTimePrecise()
  - Linux CLOCK_REALTIME_COARSE  -> GetSystemTimeAsFileTime()
  - Linux CLOCK_MONOTONIC_COARSE -> QueryUnbiasedInterruptTime()
  - Linux CLOCK_BOOTTIME         -> QueryInterruptTimePrecise()

Documentation on the clock crew has been added to clock_gettime() in the
docstring and in redbean's documentation too. You can read that to learn
interesting facts about eight essential clocks that survived this purge.
This is original research you will not find on Google, OpenAI, or Claude

I've tested this change by porting *NSYNC to become fully clock agnostic
since it has extensive tests for spotting irregularities in time. I have
also included these tests in the default build so they no longer need to
be run manually. Both CLOCK_REALTIME and CLOCK_MONOTONIC are good across
the entire amd64 and arm64 test fleets.
2024-09-04 01:32:46 -07:00
..
access_test.c Delete ASAN 2024-06-22 05:45:49 -07:00
BUILD.mk Implement proper time zone support 2024-05-04 23:06:37 -07:00
cachestat_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
chdir_test.c Delete ASAN 2024-06-22 05:45:49 -07:00
clock_getres_test.c Delve into clock rabbit hole 2024-09-04 01:32:46 -07:00
clock_gettime_test.c Delve into clock rabbit hole 2024-09-04 01:32:46 -07:00
clock_nanosleep_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
closefrom_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
commandv_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
copy_file_range_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
devfd_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
dup_test.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
fchdir_test.c Bring back gc() function 2024-01-08 10:26:28 -08:00
fchmod_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fchmodat_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
fcntl_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
fileexists_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ftruncate_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
getcontext_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getcwd_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
getgroups_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
getitimer_test.c Implement proper time zone support 2024-05-04 23:06:37 -07:00
getprogramexecutablename_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
getrandom_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
ioctl_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
life.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
lock2_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
lock_ofd_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
lock_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
lseek_test.c Share file offset across execve() on Windows 2024-08-03 17:48:00 -07:00
madvise_test.c Use better memory strategy on Windows 2024-07-20 02:20:03 -07:00
makedirs_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
mkdir_test.c Fix remove() directory on Windows 2024-07-28 17:31:21 -07:00
mkntcmdline_test.c Support shebang on Windows 2024-05-20 22:11:42 -07:00
mkntenvblock_test.c Bring back gc() function 2024-01-08 10:26:28 -08:00
mkntpath_test.c Fix relative Windows path normalization (#1261) 2024-08-16 11:55:49 -07:00
open_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
openatemp_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
openbsd_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
pipe_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
pledge2_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
pledge_test.c Add crash proofing to ipv4.games server 2024-08-26 12:57:28 -07:00
poll_test.c Fix bugs in poll(), select(), ppoll(), and pselect() 2024-09-02 00:29:52 -07:00
posix_fadvise_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
pread_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
preadv_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
raise_test.c Make mmap() scalable 2024-07-05 23:26:00 -07:00
read_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
readansi_test.c Implement proper time zone support 2024-05-04 23:06:37 -07:00
readlinkat_test.c Fix bug with realpath() on Windows 2024-05-29 18:47:01 -07:00
readwrite_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
renameat_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
reservefd_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
sched_getcpu_test.c Make Cosmo mutexes competitive with Apple Libc 2024-09-02 19:03:11 -07:00
sched_setscheduler_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
seccomp_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
select_test.c Fix bugs in poll(), select(), ppoll(), and pselect() 2024-09-02 00:29:52 -07:00
setrlimit_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
shm_open_test.c Fix ctype.h and wctype.h 2024-07-21 15:54:17 -07:00
sig_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
sigaction_test.c Delete ASAN 2024-06-22 05:45:49 -07:00
sigaltstack_test.c Release Cosmopolitan v3.5.6 2024-07-20 02:43:10 -07:00
sigbus_test.c Simplify memory manager 2024-07-05 05:47:15 -07:00
signal_test.c Favor siginfo_t over struct siginfo 2024-05-28 02:34:17 -07:00
sigpending_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
sigprocmask_test.c Avoid linker conflicts on DescribeFoo symbols 2024-08-24 18:10:22 -07:00
sigsuspend_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
sigtimedwait_test.c Run clang-format (#1197) 2024-06-01 16:30:43 -04:00
specialfile_test.c Add /dev/(u)random on NT (#1163) 2024-05-03 07:59:51 -07:00
splice_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
stackoverflow1_test.c Fix MODE=optlinux and MODE=tiny builds 2024-07-23 04:04:19 -07:00
stackoverflow2_test.c Fix MODE=optlinux and MODE=tiny builds 2024-07-23 04:04:19 -07:00
stackoverflow3_test.c Fix MODE=optlinux and MODE=tiny builds 2024-07-23 04:04:19 -07:00
stackoverflow4_test.c Fix MODE=optlinux and MODE=tiny builds 2024-07-23 04:04:19 -07:00
stackoverflow5_test.c Fix MODE=optlinux and MODE=tiny builds 2024-07-23 04:04:19 -07:00
stat_test.c Bring back gc() function 2024-01-08 10:26:28 -08:00
statfs_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
symlinkat_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
timespec_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
tiny64.elf Bump support up to FreeBSD 13 and NetBSD 9.2 2022-06-11 10:36:17 -07:00
unlinkat_test.c Delete ASAN 2024-06-22 05:45:49 -07:00
unveil_test.c Make realloc() go 100x faster on Linux/NetBSD 2024-07-07 12:40:30 -07:00
utimensat_test.c Implement proper time zone support 2024-05-04 23:06:37 -07:00
vfork_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
write_test.c Delete ASAN 2024-06-22 05:45:49 -07:00
writev_test.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
zipread.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00