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


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

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


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

示例1: value_Entered_CB

void qt_MJD::value_Entered_CB ()
{
  MJD newval;
  if (newval.Construct (value.text().ascii()) < 0) {
    if (MJD::verbose)
      std::cerr << "qt_MJD:: invalid mjd:" << value.text() << std::endl;
    newval = valset;
  }
  setMJD (newval);
}
开发者ID:SkyTian13,项目名称:psrchive,代码行数:10,代码来源:qt_MJD.C

示例2: lseek

MJD dsp::Mark4File::decode_date(uint64_t from)
{
  char *timecode = new char[8*channels]; // 8 bytes per channel

  MJD date;
  MJD current;
  utc_t utcdate;
  utc_t tmpdate;
  
  // Special lookup table, see documentation for Mark4 formaters.
  // 0=0, 1=1.25, 2=2.5, 3=3.75, 4=NA, 5=5.0, 6=6.25, 7=7.5, 8=8.75, 9=NA
  //Required for Mark4 standard format
  float time_code_table[] = {0,1.25,2.5,3.75,0.0,5.0,6.25,7.50,8.75,0.0};

  current.Construct(time(NULL));
  
  uint64_t inital_pos = lseek(fd, 0, SEEK_CUR);
  
  uint64_t next_sync = find_sync(fd, from);
  
  // Read the 8 bytes after the SYNC - and handle them as per modes
  lseek(fd,next_sync+4*channels,SEEK_SET);
  
  read(fd, timecode, 8*channels);

  int stepsize = channels/8;

  int julian = 0;
  int year   = 0;
  int day    = 0;
  int hour   = 0;
  int minute = 0;
  double second = 0.0;
  char tmp[4];
  
  switch(mode) {
    
  case VLBA:

    // Date format for VLBA = JJJSSSSS.ssss
    
    // JJJ
    tmp[0] = timecode[0*stepsize];
    tmp[1] = timecode[1*stepsize];
    tmp[2] = timecode[2*stepsize];
    tmp[3] = timecode[3*stepsize];
    julian += decode_bcd(tmp)*100;

    tmp[0] = timecode[4*stepsize];
    tmp[1] = timecode[5*stepsize];
    tmp[2] = timecode[6*stepsize];
    tmp[3] = timecode[7*stepsize];
    julian += decode_bcd(tmp)*10;

    tmp[0] = timecode[8*stepsize];
    tmp[1] = timecode[9*stepsize];
    tmp[2] = timecode[10*stepsize];
    tmp[3] = timecode[11*stepsize];
    julian += decode_bcd(tmp)*1;
    
    //SSSSS
    tmp[0] = timecode[12*stepsize];
    tmp[1] = timecode[13*stepsize];
    tmp[2] = timecode[14*stepsize];
    tmp[3] = timecode[15*stepsize];
    second += decode_bcd(tmp)*10000.0;

    tmp[0] = timecode[16*stepsize];
    tmp[1] = timecode[17*stepsize];
    tmp[2] = timecode[18*stepsize];
    tmp[3] = timecode[19*stepsize];
    second += decode_bcd(tmp)*1000.0;

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

    tmp[0] = timecode[24*stepsize];
    tmp[1] = timecode[25*stepsize];
    tmp[2] = timecode[26*stepsize];
    tmp[3] = timecode[27*stepsize];
    second += decode_bcd(tmp)*10.0;

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

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

    tmp[0] = timecode[36*stepsize];
    tmp[1] = timecode[37*stepsize];
//.........这里部分代码省略.........
开发者ID:gitj,项目名称:dspsr,代码行数:101,代码来源:Mark4File.C


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