The two primary aspects of time setup are typically setting the time zone and setting the Network Time Protocol (NTP) server. The systemsetup command can be used to set both of these date and time options for Mac OS X computers. To see a listing of the available time zones in Mac OS X use the systemsetup with the -listtimezones option as follows:
systemsetup -listtimezones
Once you have the time zones you can then use systemsetup with the -settimezone option to configure the time zone on your system. It is often easiest to simply paste the time zone into the command. So to set the time zone to Detroit for example, you would use the following command:
systemsetup -settimezone America/Detroit
Once the time zone has been set then you’ll need to setup the time server. Prior to setting an NTP server, first enable network time. This can be done by using the systemsetup command with the -setusingnetworktime option followed by on or off (according to whether it is being enabled or disabled, in this case enabled):
systemsetup -setusingnetworktime on
Finally, set the actual NTP server. To set an NTP server use the -setnetworktimeserver option with systemsetup, followed by the name or IP address of the server. For example, to set the NTP server to ntp.krypted.com you would use the following command:
systemsetup -setnetworktimeserver ntp.krypted.com
Finally, you need to verify the time is correct. To do so you can use the date command. Or you can use the systemsetup command with the -gettime option as follows:
systemsetup -gettime
If you’re not using an NTP server then you’ll need to use the -settime and -setdate options to set the time and date respectively with systemsetup. Each is separated by a : character. The date is set using mm:dd:yy, so to set the date to July 12th, 2009 use the following command:
systemsetup -setdate 07:12:09
To then set the time to 11:30pm with no seconds use the following command:
systemsetup -settime 11:30:00
America/Detroi