The NTSC clock crystal in your PC clocks at 14318180Hz (look at the clock chips on your MB and VGA). This was divided by 3 to get the 4.77 MHz clock used by the original IBM PC. It's divided by 4 to get the 3.579545 MHz "colorburst" frequency used by CGA, and by various TV cards. And it's divided by 12 to give the 1.19318... MHz "clock" used by the timer chips.
The 1.19318... MHz signal is divided by 65,536 (64k) to give the "clock ticks" the PC uses to keep track of time of day (stored at 0040:006Ch). These occur every approximately 18.20650737... times a second.
ticks | elapsed time |
---|---|
1 | 0.0549 sec |
~18 | 1 sec |
~1092 | 1 min |
~65,543 | 1 hr |
~1,573,042 | 1 day |
The BIOS uses 1573040 ticks per day. That's 1573040 ticks = 86400 seconds. This reduces to the not particularly useful ratio of 19663 ticks = 1080 secs.
For converting ticks to seconds, you can use 65536 ticks = 3600 seconds (64k ticks = 1 hour), this is too small by about 112 parts per million, which isn't enough to worry about in most apps.
For converting seconds to ticks (why?) you can use the more accurate 16384 seconds = 298295 ticks. That's off by 25 parts per *billion*. Which will hardly ever bother you.
hh:mm:ss:tt | secs | ticks |
---|---|---|
00:00:00:00 | 0 | 0 |
00:18:00:00 | 1080 | 19663 |
00:36:00:00 | 2160 | 39326 |
00:54:00:00 | 3240 | 58989 |
00:59:59:11 | 3600- | 65536 |
01:12:00:00 | 4320 | 78652 |
01:30:00:00 | 5400 | 98315 |
01:48:00:00 | 6480 | 117978 |
01:59:59:04 | 7200- | 131072 |
02:06:00:00 | 7560 | 137641 |
02:24:00:00 | 8640 | 157304 |
02:42:00:00 | 9720 | 176967 |
02:59:59:14 | 10798- | 196608 |
03:00:00:00 | 10800 | 196630 |
03:18:00:00 | 11880 | 216293 |
03:36:00:00 | 12960 | 235956 |
03:54:00:00 | 14040 | 255619 |
03:59: | ||
04:12:00:00 | 15120 | 275282 |
04:30:00:00 | 16200 | 294945 |
04:33:04:00 | 16384 | 298294.9926 |
04:48:00:00 | 17280 | 314608 |
05:06:00:00 | 18360 | 334271 |
05:24:00:00 | 19440 | 353934 |
05:42:00:00 | 20520 | 373597 |
06:00:00:00 | 21600 | 393260 |
06:18:00:00 | 22680 | 412923 |
06:36:00:00 | 23760 | 432586 |
06:54:00:00 | 24840 | 452249 |
07:12:00:00 | 25920 | 471912 |
07:30:00:00 | 27000 | 491575 |
07:48:00:00 | 28080 | 511238 |
08:06:00:00 | 29160 | 530901 |
08:24:00:00 | 30240 | 550564 |
08:42:00:00 | 31320 | 570227 |
09:00:00:00 | 32400 | 589890 |
09:06:08:00 | 32768 | 596589.9852 |
09:18:00:00 | 33480 | 609553 |
09:36:00:00 | 34560 | 629216 |
09:54:00:00 | 35640 | 648879 |
10:12:00:00 | 36720 | 668542 |
10:30:00:00 | 37800 | 688205 |
10:48:00:00 | 38880 | 707868 |
11:06:00:00 | 39960 | 727531 |
11:24:00:00 | 41040 | 747194 |
11:42:00:00 | 42120 | 766857 |
12:00:00:00 | 43200 | 786520 |
12:18:00:00 | 44280 | 806183 |
12:36:00:00 | 45360 | 825846 |
12:54:00:00 | 46440 | 845509 |
13:12:00:00 | 47520 | 865172 |
13:30:00:00 | 48600 | 884835 |
13:39:12:00 | 49152 | 894884.9778 |
13:48:00:00 | 49680 | 904498 |
14:06:00:00 | 50760 | 924161 |
14:24:00:00 | 51840 | 943824 |
14:42:00:00 | 52920 | 963487 |
15:00:00:00 | 54000 | 983150 |
15:18:00:00 | 55080 | 1002813 |
15:36:00:00 | 56160 | 1022476 |
15:54:00:00 | 57240 | 1042139 |
16:12:00:00 | 58320 | 1061802 |
16:30:00:00 | 59400 | 1081465 |
16:48:00:00 | 60480 | 1101128 |
17:06:00:00 | 61560 | 1120791 |
17:24:00:00 | 62640 | 1140454 |
17:42:00:00 | 63720 | 1160117 |
18:00:00:00 | 64800 | 1179780 |
18:12:16:00 | 65536 | 1193179.970 |
18:18:00:00 | 65880 | 1199443 |
18:36:00:00 | 66960 | 1219106 |
18:54:00:00 | 68040 | 1238769 |
19:12:00:00 | 69120 | 1258432 |
19:30:00:00 | 70200 | 1278095 |
19:48:00:00 | 71280 | 1297758 |
20:06:00:00 | 72360 | 1317421 |
20:24:00:00 | 73440 | 1337084 |
20:42:00:00 | 74520 | 1356747 |
21:00:00:00 | 75600 | 1376410 |
21:18:00:00 | 76680 | 1396073 |
21:36:00:00 | 77760 | 1415736 |
21:54:00:00 | 78840 | 1435399 |
22:12:00:00 | 79920 | 1455062 |
22:30:00:00 | 81000 | 1474725 |
22:45:20:00 | 81920 | 1491474.963 |
22:48:00:00 | 82080 | 1494388 |
23:06:00:00 | 83160 | 1514051 |
23:24:00:00 | 84240 | 1533714 |
23:42:00:00 | 85320 | 1553377 |
24:00:00:00 | 86400 | 1573040 |
time | sec | ticks |
---|---|---|
00:00:00 | 0 | 0 |
01:00:00 | 3599.5972 | 65536 |
01:59:59 | 7199.1944 | 131072 |
02:59:59 | 10798.792 | 196608 |
03:59:58 | 14398.389 | 262144 |
04:59:58 | 17997.986 | 327680 |
05:59:58 | 21597.583 | 393216 |
06:59:57 | 25197.18 | 458752 |
07:59:57 | 28796.778 | 524288 |
08:59:56 | 32396.375 | 589824 |
09:59:56 | 35995.972 | 655360 |
10:59:56 | 39595.569 | 720896 |
11:59:55 | 43195.167 | 786432 |
12:59:55 | 46794.764 | 851968 |
13:59:54 | 50394.361 | 917504 |
14:59:54 | 53993.958 | 983040 |
15:59:54 | 57593.555 | 1048576 |
16:59:53 | 61193.153 | 1114112 |
17:59:53 | 64792.75 | 1179648 |
18:59:52 | 68392.347 | 1245184 |
19:59:52 | 71991.944 | 1310720 |
20:59:52 | 75591.541 | 1376256 |
21:59:51 | 79191.139 | 1441792 |
22:59:51 | 82790.736 | 1507328 |
23:59:50 | 86390.333 | 1572864 |