X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Trace-PostClient-IP: 68.147.232.190 From: Brian Inglis Newsgroups: comp.os.msdos.djgpp Subject: Re: Performance enhancement for gettimeofday()? Organization: Systematic Software Message-ID: <5t3iq2dlv4hoh2sdf9c4dbot50e6ge28mn@4ax.com> References: X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 47 Date: Sat, 13 Jan 2007 18:09:46 GMT NNTP-Posting-Host: 64.59.135.176 X-Complaints-To: abuse AT shaw DOT ca X-Trace: pd7urf3no 1168711786 64.59.135.176 (Sat, 13 Jan 2007 11:09:46 MST) NNTP-Posting-Date: Sat, 13 Jan 2007 11:09:46 MST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Wed, 10 Jan 2007 13:25:42 -0500 in comp.os.msdos.djgpp, "Rod Pemberton" wrote: > > wrote in message >news:OF77475379 DOT 7BA371D5-ON8725725F DOT 00598107-8725725F DOT 0059B5ED AT seagate DOT com... >> Rod Pemberton wrote on Tue, 9 Jan 2007 at 03:46:03 -0500: >> >> # I believe this it the math you'll need: >> # >> # 14.318Mhz=4*3.58Mhz=4*(4.5Mhz*455/572) >> # (4.5Mhz US TV bandwith/channel, 455 colorburst phase changes/line, >> 572 >> # total lines/frame including sync) >> # 14.318Mhz/12=1.93182Mhz >> >> Aha, this is the one that's why our numbers don't agree: >> 14.318MHz divided by 12 is actually 1.193666... MHz. >> > >Sorry, it appears I failed to type a 1 following the decimal. It's not >14.318000MHz, but 14.318181MHz. You really need to enter >4*4.5*(10^6)*455/572 to compute the 14.318MHz and work from there. IIRC >('twas 25+ years ago), it's 4 times the colorburst as calculated by the >original engineer who designed the US color TV standard. That way you won't >loose precision. Of course, a real crystal usually has a tolerance range, >but that range is usually small compared to the frequency, like +/- 100Hz or >+/-10KHz. Of course, you could go to Mouser or another electronic supplier, >and look for a crystal if you think the range would help. > >Like you, I'll use ... for repeating digits. The 1 and 8 repeat for both. >I was using more decimals but rounded/truncated. > >14.318181818181... Mhz / 12 = 1.193181818181... Mhz. >1.193181818181...Mhz / 65536 = 18.206509676846 Hz IIRC crystal frequency 157.5MHz = 9/2*7*5*1E6, /11 colour burst 14318181.8..Hz, /3 for PC clock 4772727.27..Hz, /4 for timer 1193181.8..Hz, /65536 for tick 18.2065096768465909..Hz, giving a period of 54925.4095238..us with the last six digits repeating. So the relevant factors here are 7*5*3/11/2^19. -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca) fake address use address above to reply