Note: If you got here using a web search engine, you can find the program here.
Disclaimer: Although Daytime seems to work fine, it is distributed "as is". Use at your own risk. So there. (Daytime is officially supported by the Baylor ITC and is supposedly on the "standard config".)
Daytime is a small application that sets the clock on your Macintosh to the time/date returned from a specified host computer. It requires MacTCP or OpenTransport and a host computer that responds to "daytime" (UDP) requests. Daytime is different from other programs that are based on the networktime protocol. It uses the daytime protocol (hosts send the time and date as clear text like "Friday, August 13, 1993 9:19:44AM-CST" or "Fri Aug 13 09:19:44 1993" that must be parsed by a client.) Consequently, the time may not be as exact, but it is very close. Daytime will also set the timezone (hours off GMT) and daylight savings time setting if timezone information is sent from the server.
Because there is no official format for the returned date, Daytime uses a format string that specifies what the date looks like. Use the following field descriptors to tell Daytime how to parse the date:
%m month of year (1-12) %B full month name (e.g., April) %b abbreviated month name (e.g., Apr) %d day of month (1-31) %A full weekday (e.g., Tuesday) %a abbreviated weekday (e.g., Tue) %y last two digits of year (00-99) %Y four digit year (e.g., 1997) %H hour in 24-hour format (00-23) %I hour in 12-hour format (1-12) %M minute (00-59) %S second (00-59) %p AM/PM string (e.g, A.M.) %Z timezone (e.g., CST) %- skip word (up to whitespace) %% literal % <space> whitespace (space, tab, ff, etc.) <char> specified char
So to parse the date response that looks like:
Tuesday, March 18, 1997 6:12:51PM-CST
you would use the format string:
%A, %B %d, %Y %I:%M:%S%p-%Z
To parse the date response:
Wed Apr 2 17:58:01 1997
you would use the format string:
%a %b %d %H:%M:%S %Y
For the most part, these format specifiers correspond to those of the unix 'date' command.
Both the host computer's IP address and the format are stored internally as 'STR ' resources (ID 128 and 129). To change them, hold down the command key while the program starts. Note that this will not work if the file is locked or if Daytime is run from a locked volume. You can also use ResEdit to change them if you want. There are also two timeout values: network (how long to wait for a response from the server) and message (how long to show an alert window). These are also stored as 'STR ' resources but you must use ResEdit to change them.
You can keep people from changing the defaults by using ResEdit to create an empty resource of type 'LOCK' (ID 128). If Daytime is launched with the command key pressed but that resource exists, Daytime will not bring up the setup dialog but will continue as if the command key was not pressed.
There are also 'STR#' resources that tell Daytime how to recognize particular strings: full month names, abbreviated month names, full weekday names, abbreviated weekday names, "AM" and "PM" strings. If your daytime server doesn't send back the date in English, you'll need to change them with ResEdit. Note that they are not case dependant so Apr, APR, and apr all considered equivalent.
One last resource is the 'TZON' resource that tells Daytime how to interpret timezone strings from the server. It also specifies the number of hours off GMT as well as whether or not daylight savings time is "on". The North American timezones between Atlantic and Hawaiian are included. If you are running this elsewhere, e.g., Australia, you'll need to use ResEdit to add the appropriate string(s) for your timezone.
Alert windows will timeout after a certain amount of time (as noted above). You can run the program at startup by putting it in the Startup Items folder and not worry about the Mac sitting there all night waiting for you to press "OK".
If you have any questions, comments, (constructive) criticism, or bug reports please let me know. You can contact me at the address(es) below.
Carl Bell's Web Page
Stuff I've Written
Carl W. BellPhone:
Academic and Research Computing Services
Baylor University Electronic Library
One Bear Place #97148
Waco, TX 76798
(254) 710-4065Baylor's Fine Print:
This software, data and/or documentation contain trade secrets and confidential information which are proprietary to Baylor University. Their use or disclosure in whole or in part without the express written permission of Baylor University is prohibited.
This software, data and/or documentation are also unpublished works protected under the copyright laws of the United States of America. If these works become published, the following notice shall apply:
Copyright © 1991-1997 Baylor UniversityThe name of Baylor University may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE, DATA AND/OR DOCUMENTATION ARE PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
All Rights Reserved
When permission has been granted to make copies of this software, data and/or documentation, the above notices must be retained on all copies.
Permission is hereby granted for non-commercial use and distribution of Daytime.