cosmopolitan/tool/net
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
..
demo Stop using .com extension in monorepo 2024-03-03 03:12:19 -08:00
tiny Stop using .com extension in monorepo 2024-03-03 03:12:19 -08:00
.init.lua Add SSL to redbean 2021-06-24 13:20:50 -07:00
BUILD.mk Implement proper time zone support 2024-05-04 23:06:37 -07:00
counters.inc Make fixes and improvements 2022-10-19 07:19:19 -07:00
definitions.lua Delve into clock rabbit hole 2024-09-04 01:32:46 -07:00
dig.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
echo.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
favicon.ico Make major improvements to redbean and libraries 2021-04-18 12:34:15 -07:00
fetch.inc Refactor and improve CTL and other code 2024-06-04 05:45:48 -07:00
getadaptersaddresses.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
help.txt Delve into clock rabbit hole 2024-09-04 01:32:46 -07:00
largon2.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
launch.c Support any HTTP method 2024-02-22 14:12:18 -08:00
lfinger.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
lfinger.h Reduce header complexity 2023-11-28 14:39:42 -08:00
lfuncs.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
lfuncs.h [Redbean] Add UuidV7 method (#1213) 2024-07-01 06:06:56 -07:00
libresolv_query.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
ljson.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
ljson.h Reduce header complexity 2023-11-28 14:39:42 -08:00
lmaxmind.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
lpath.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
lpath.h Reduce header complexity 2023-11-28 14:39:42 -08:00
lre.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
lsqlite3.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
luacheck.h Reduce header complexity 2023-11-28 14:39:42 -08:00
redbean-original.c Remove plenty of makefile misconfigurations 2022-07-21 09:20:59 -07:00
redbean-static.c Remove plenty of makefile misconfigurations 2022-07-21 09:20:59 -07:00
redbean-unsecure.c Remove plenty of makefile misconfigurations 2022-07-21 09:20:59 -07:00
redbean.c Fix the build 2024-08-26 16:44:05 -07:00
redbean.png Make improvements 2020-09-14 00:02:34 -07:00
sandbox.h Introduce #include <cosmo.h> to toolchain users 2023-06-09 18:03:05 -07:00
winbench.c Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00