Changeset 162
- Timestamp:
- 10/13/2009 03:10:46 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SH_SHM/trunk/source/gcf/gcflib.c
r160 r162 255 255 int i; /* counter */ 256 256 NTIME ntime; /* numeric start time */ 257 int offset; /* time offset */ 258 int denom; /* denominator of fraction of seconds */ 259 float secoff; /* offset in seconds */ 257 260 258 261 /* executable code */ … … 287 290 /* data format bytes */ 288 291 hdr->smprate = (rhdr->data_format & 0x00ff0000) >> 16; 289 hdr->cmpcode = (rhdr->data_format & 0x0000 ff00) >> 8;292 hdr->cmpcode = (rhdr->data_format & 0x00000f00) >> 8; 290 293 hdr->numrec = (rhdr->data_format & 0x000000ff); 294 295 /* extended settings */ 296 offset = (rhdr->data_format & 0x0000f000) >> 12; /* time offset */ 297 switch (hdr->smprate) { 298 case 157: hdr->smprate = 0; /* should be 0.1 */ denom=0; break; 299 case 161: hdr->smprate = 0; /* should be 0.125 */ denom=0; break; 300 case 162: hdr->smprate = 0; /* should be 0.2 */ denom=0; break; 301 case 164: hdr->smprate = 0; /* should be 0.25 */ denom=0; break; 302 case 167: hdr->smprate = 0; /* should be 0.5 */ denom=0; break; 303 case 171: hdr->smprate = 400; denom=8; break; 304 case 174: hdr->smprate = 500; denom=2; break; 305 case 176: hdr->smprate = 1000; denom=4; break; 306 case 179: hdr->smprate = 2000; denom=8; break; 307 case 181: hdr->smprate = 4000; denom=16; break; 308 } /*endswitch*/ 309 310 /* add fraction of seconds to start time, if specified */ 311 if (denom != 0 && offset > 0) { 312 NTIME corrtime; /* corrected time */ 313 secoff = (float)offset / (float)denom; 314 tc_nadd( &ntime, secoff, &corrtime, status ); 315 if (SySevere(status)) return; 316 tc_n2t( &corrtime, hdr->blktime, status ); 317 } /*endif*/ 291 318 292 319 } /* end of GcfDecodeHeader */ … … 522 549 523 550 if (samples[j-1] != block[numrec+1]) 524 *status = GcfERR_CHKSUM; 551 /* *status = GcfERR_CHKSUM; */ 552 printf( "Gcf checksum error (%d != %d)\n", samples[j-1], block[numrec+1] ); 525 553 526 554 } /* GcfDecodeBlock */ … … 774 802 tdiff_start = tc_ndiff( &req_ntime, &cur_ntime, status ); 775 803 if (SySevere(status)) return; 776 cur_span = (float)(hdr.numrec*hdr.cmpcode/hdr.smprate); 804 cur_span = (hdr.smprate == 0) 805 ? 0.0 : (float)(hdr.numrec*hdr.cmpcode/hdr.smprate); 777 806 if (tdiff_start >= 0.0) { 778 807 if (cur_span > tdiff_start) { … … 886 915 tdiff_start = tc_ndiff( &req_ntime, &cur_ntime, status ); 887 916 if (Severe(status)) return; 888 cur_span = (float)(hdr.numrec*hdr.cmpcode/hdr.smprate); 917 cur_span = (hdr.smprate == 0) 918 ? 0.0 : (float)(hdr.numrec*hdr.cmpcode/hdr.smprate); 889 919 } /*endwhile*/ 890 920
Note: See TracChangeset
for help on using the changeset viewer.