当前位置: 首页>>代码示例>>C++>>正文


C++ MJD::UTC方法代码示例

本文整理汇总了C++中MJD::UTC方法的典型用法代码示例。如果您正苦于以下问题:C++ MJD::UTC方法的具体用法?C++ MJD::UTC怎么用?C++ MJD::UTC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MJD的用法示例。


在下文中一共展示了MJD::UTC方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lseek


//.........这里部分代码省略.........
    tmp[2] = timecode[14*stepsize];
    tmp[3] = timecode[15*stepsize];
    day += decode_bcd(tmp)*1;


    // HH
    tmp[0] = timecode[16*stepsize];
    tmp[1] = timecode[17*stepsize];
    tmp[2] = timecode[18*stepsize];
    tmp[3] = timecode[19*stepsize];
    hour += decode_bcd(tmp)*10;

    tmp[0] = timecode[20*stepsize];
    tmp[1] = timecode[21*stepsize];
    tmp[2] = timecode[22*stepsize];
    tmp[3] = timecode[23*stepsize];
    hour += decode_bcd(tmp)*1;

    // MM
    tmp[0] = timecode[24*stepsize];
    tmp[1] = timecode[25*stepsize];
    tmp[2] = timecode[26*stepsize];
    tmp[3] = timecode[27*stepsize];
    minute += decode_bcd(tmp)*10;

    tmp[0] = timecode[28*stepsize];
    tmp[1] = timecode[29*stepsize];
    tmp[2] = timecode[30*stepsize];
    tmp[3] = timecode[31*stepsize];
    minute += decode_bcd(tmp)*1;


    // SS
    tmp[0] = timecode[32*stepsize];
    tmp[1] = timecode[33*stepsize];
    tmp[2] = timecode[34*stepsize];
    tmp[3] = timecode[35*stepsize];
    second += decode_bcd(tmp)*10.0;

    tmp[0] = timecode[36*stepsize];
    tmp[1] = timecode[37*stepsize];
    tmp[2] = timecode[38*stepsize];
    tmp[3] = timecode[39*stepsize];
    second += decode_bcd(tmp)*1.0;


    // .sss
    tmp[0] = timecode[40*stepsize];
    tmp[1] = timecode[41*stepsize];
    tmp[2] = timecode[42*stepsize];
    tmp[3] = timecode[43*stepsize];
    second += decode_bcd(tmp)*0.1;

    tmp[0] = timecode[44*stepsize];
    tmp[1] = timecode[45*stepsize];
    tmp[2] = timecode[46*stepsize];
    tmp[3] = timecode[47*stepsize];
    second += decode_bcd(tmp)*0.01;

    tmp[0] = timecode[48*stepsize];
    tmp[1] = timecode[49*stepsize];
    tmp[2] = timecode[50*stepsize];
    tmp[3] = timecode[51*stepsize];
    second += time_code_table[decode_bcd(tmp)]*0.001;
    
    
    current.UTC(&tmpdate,0);

    if(tmpdate.tm_year%10 >= year){
      year += int(tmpdate.tm_year/10)*10;
    }else{
      year += int((tmpdate.tm_year/10)-1)*10;
    }
    
    utcdate.tm_year = year;
    utcdate.tm_yday = day;
    utcdate.tm_hour = hour;
    utcdate.tm_min  = minute;
    utcdate.tm_sec  = int(second);
    
    date  = MJD(utcdate);
    date +=  second-int(second); // add fractions of seconds.

    break;
 
   
  default:
    cerr << "Unknown mode - " << mode << endl;
    
  }
  
  //  cerr << "SEEK_CUR: " << lseek(fd,0,SEEK_CUR);
  //  lseek(fd,next_sync-8*channels,SEEK_SET);  // position of decoded time.
  //  cerr << "\t" << lseek(fd,0,SEEK_CUR)/channels << endl; 
  
  lseek(fd,inital_pos,SEEK_SET);  // restored original file pointer
  
  return date;
  
}
开发者ID:gitj,项目名称:dspsr,代码行数:101,代码来源:Mark4File.C


注:本文中的MJD::UTC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。