cosmopolitan/tool/viz
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
..
lib Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
ascii2utf8.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
basicidea.c Refactor some code 2024-05-26 06:03:50 -07:00
bd.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
bin2asm.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
bing.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
BUILD.mk Implement proper time zone support 2024-05-04 23:06:37 -07:00
clock_accuracy.c Cull the examples folder 2023-10-11 21:45:32 -07:00
clock_nanosleep_accuracy.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
cpuid.c Simplify memory manager 2024-07-05 05:47:15 -07:00
datauri.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
deathstar.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
derasterize.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
dumphexc.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
fixconsole.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
fliphex.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
fold.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
fontspace.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
generatetortureimage.c Bring back gc() function 2024-01-08 10:26:28 -08:00
getglyph.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
getifaddrs.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
hwcap.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
img.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
life.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
malloc_scalability.c Fix the build 2024-08-26 16:44:05 -07:00
maxmind.c Run clang-format (#1197) 2024-06-01 16:30:43 -04:00
memzoom.c Delve into clock rabbit hole 2024-09-04 01:32:46 -07:00
od16.c Update stb (#885) 2023-12-22 21:39:27 -08:00
printansi.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
printdos2errno.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
printimage.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
printvideo.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
rlimit.c Avoid linker conflicts on DescribeFoo symbols 2024-08-24 18:10:22 -07:00
setitimer_accuracy.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
tailf.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
unbing.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
vdsodump.c Make malloc scalable on all platforms 2024-08-15 23:32:53 -07:00
virtualquery.c Avoid linker conflicts on DescribeFoo symbols 2024-08-24 18:10:22 -07:00