AmendHub

Download

vkoskiv

/

MacNTP

/

README

 

(View History)

vkoskiv   Store UTC offset as string and change some rsrc IDs Latest amendment: 17 on 2023-09-17

1 MacNTP is the premier network time solution for System 6 users running MacTCP on their 68k Macs. It pretty much just does what it says on the tin - seamlessly updates the system clock of your Mac via NTP at boot time, so you don't need to put a leak-prone clock battery in your precious computer.
2
3 MacNTP is © Valtteri Koskivuori (vkoskiv), and ISC-licensed.
4 If you find it useful, please don't hesitate to reach out with feedback or feature suggestions. You can reach me by mailing a letter to:
5
6 - Valtteri Koskivuori, P.O. Box 347, Helsinki, Finland
7 - Just kidding, my details are at the end of this document
8
9 More details:
10
11 During boot, MacNTP will check the system clock, and if it detects a time in the 20th century, it will attempt to query the configured NTP servers for the current time. The INIT will display the MacNTP icon in the "pending" state. If the NTP request succeeds or fails, the icon is updated to reflect the result.
12 If the icon is in the "Pending" state for an unusually long time, chances are it's stuck doing DNS lookups. It will eventually time out, though.
13
14 -- Build instructions below if you want to compile it yourself --
15
16 Prerequisites:
17 - System 6 (I haven't tested on other systems)
18 - MacTCP installed and properly configured (check that your connection works before trying this!)
19 - Think C 5.0.1
20
21 Setup:
22 Think C 5 doesn't support the kind of multi-target project that combines both an INIT and a cdev, so we have to work around it. We need two projects, and we will first build a cdev (Control Panel Document), and then build a second project to inject the INIT resource into our cdev.
23 1. Create new Think C project, name it "MacNTP.π" (option+p gets you π)
24 2. To this project, add only cdev.c and MacTraps from Think C's Mac Libraries.
25 3. Set the project settings like this:
26 - Select Code Resource.
27 - File Type = "cdev"
28 - Creator = "VKOS"
29 - Type = "cdev"
30 - ID = "-4064"
31 - Attrs = 00
32 - Leave "Custom Header" deselected.
33 - Ensure that under Edit->Options... under Compiler Settings, "Generate 68020 instructions" is deselected.
34
35 4. Use the SARez tool to compile "MacNTP.π.r" into a resource file, name it "MacNTP.π.rsrc" - It's important you name it exactly that, and that it resides in the same directory as the project file created above, otherwise Think C won't find it.
36 5. Select "Build Code Resource" under "Project" to build the cdev document. Think C will then prompt you for a file name for the cdev document. cdevs and INITs are loaded in alphabetical order, so it is important you choose a name that comes after "MacTCP" alphabetically, as MacNTP depends on MacTCP being present. I usually name it "nMacNTP" to have it load last. Save this file somewhere, and close the MacNTP project.
37
38 6. Create another project, call it "MacNTPINIT.π". Add all .c files except for "cdev.c", as well as MacTraps and MacTraps2 from Think C's Mac Libraries
39 7. Again, ensure 68020 generation is disabled like in step 3, then select Project->Set Project Type, set the settings like this:
40 - Select Code Resource
41 - Set File Type to "INIT"
42 - Creator to "VKOS"
43 - Type to "INIT"
44 - ID to "0" (zero)
45 - Attrs to 70. Leave Custom Header deselected, and hit OK.
46 8. Select "Build Code Resource" under "Project" to build the INIT resource, but when the save dialog appears, specify the same file as in step 5 with the same filename, and tick the "Merge" option. This way, Think C will build a freestanding INIT resource and inject it into the existing file, preserving the resources that were already copied there from MacNTP.π.rsrc when you built the file in step 5.
47 9. Open the final file in ResEdit, hit File->Get Info For..., and untick the "No INITS" property if it is enabled, then save and quit. I haven't figured out a workaround for this in Think C.
48
49 You *should* now have a file that contains both a cdev and a INIT resource, as well as various other resources that were copied in from MacNTP.π.rsrc. You can place this file in your System Folder, and give it a go.
50 There is a decent chance I made a mistake in these instructions, or they are outdated, please don't hesitate to contact the author for assistance. This project was started in 2023, so development might still be active when you are reading this.
51
52 Caveat: Upon boot, the MacNTP INIT will check the system clock, and won't try updating it if the date is later than September 2nd, 1996. If you edit the UTC offset setting (STR) directly with ResEdit, you will need to set your clock back to before that date for it to update the system clock with the new offset.
53
54 Don't hesitate to contact me, vkoskiv, on IRC (libera) if you run into any issues. I'm also @vkoskiv on Twitter and Discord. Also vkoskiv@gmail.com
55
56 "Mac" is a trademark of Apple Inc., registered in the U.S. and other countries and regions.