Prepare for the winners of **IOCCC28**. > However these are not the 2024 droids you are looking for. :-) The HTML menu (both JavaScript and non-JavaScript) has been updated. The `Status -> Rules and guidelines' have been replaced with two separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`. Added a new top level `social.html` page: built from a new `social.md`. Sorted rules for building specific web pages in the top level `Makefile`. Added `make social` to make the `social.html` page from `social.md`. The `bin/gen-top-html.sh` now is able to process a argument of **social** to process the new top level `social.html` page. Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13" to "2.0.1 2025-07-25". Below `About -> Home page` a new `About -> IOCCC social media` menu item as added. Because the menu change touched every HTML file, we changed the general copyright date range for HTML files from "1984-2024" to "1984-2025" due to the extensive changes made for **IOCCC28**. Those markdown files that were modified in 2025 had their copyright date range also changed from "1984-2024" to "1984-2025". Rebuilt tarballs and sitemap due to the extensive HTML rebuilding. Ran `make update` to perform the above.
To build:
make
Bugs and (Mis)features:
The current status of this entry is:
STATUS: INABIAF - please DO NOT fix
For more detailed information see 2013/mills in bugs.html.
To use:
./mills
Try:
./mills &
While that is running, point your favorite browser at: http://localhost:8224.
Judges' remarks:
Who will be the first to post an image rendered during a leap-second?
Author's remarks:
The Program
This program is a handy graphical clock. Simply run the program, click OK to any annoying security dialog that pop up (aren't those annoying?), then fire up your web browser and type in the following URL: http://localhost:8224.
You will soon be presented with a lovely dynamically rendered 3D scene that also conveniently tells you the current time!
Usage Notes
The program will continue to give you the time of day as it changes by
reloading the page as often as it can render. If you grow tired of watching
your life slip by, hit Control-C in the original window. Note that if you
want to restart the program again, you should wait a minute or two before
doing so. For details as to why this is necessary, feel free to Google
"TIME_WAIT", "SO_REUSEADDR" and "SO_REUSEPORT" (with the quotes). And
while you are there, click on an ad. They could use the money.
It would be possible to fix this by adding
n=1,setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&n,sizeof n),
at an appropriate spot in the code (an exercise left to the reader). However, as this limitation is documented, it is not technically a bug.
Details of Operation
The program wears many hats (not literally). It is
- a web server
- a PNG encoder
- a ray tracer
- a clock
It replies to web requests with a PNG image that uses the Adam7 encoding to return data progressively. Since the data is returned in Adam7 format, the scene is displayed initially at a lower resolution and allowed to be progressively refined as time goes on. The ray tracer is integrally tied to the PNG encoder, casting rays in the Adam7 order. The web server uses PNG primarily because of PNG's ability to return data progressively, and not as you might think it being because the PNG standard is so obfuscated as to require both little and big-endian encodings at different spec layers.
Since ray-tracing was an obvious choice to return to a web server, I needed something to ray-trace. A static scene would be uninteresting. I took inspiration (as I often do) from the IOCCC remarks file which says
At least one judge prefers to maintain the use of the leap-second
as part of the world's time standard.
Then it was obvious; the code should display the time. It is believed (but not confirmed) that the code will, in fact, display leap seconds correctly.
To display the time, of course we would need a font. This font is encoded as a string, using only the C whitespace characters. Clearly, the judges intended this use of whitespace for data compression, since their tool doesn't count whitespace in strings differently than whitespace outside of them.
User-modifiable Features
The code can be user-modified simply by changing the build command line. The following symbols are defined in the Makefile:
-
-DLT=x1,y1,z1,x2,y2,z2,...defines the coordinates of the lights in the scene. It should be a comma-separated list of coordinates(x, y, z), three per light. -
-DNL=ndefines the number of lights. It should be equal to the length of the list above (three times the number of lights). -
-DEY=x,y,zdefines the position of the viewer (the eye point) for the scene. The eye is looking at the origin(0, 0, 0).
Other Build Flags
The original program bound the server to INADDR_ANY to allow everyone to
experience the server's output. The Judges suggested that I instead restrict
the bind to INADDR_LOOPBACK to reduce security alarms. As a compliant veteran
of innumerable post-ship late feature additions, I have modified the
Makefile to inject the new code without destroying the beautiful
spherical symmetry of the source code. In addition, I have altered the word
sin_port to the more family-friendly version win_port (via
-Dwin_port="sin_addr.s_addr=htonl(2130706433),R.sin_port") to protect against
curious impressionable youth trying to learn about sockets on the Internet.