Changeset 204 in ntrip for trunk/BNC/bncrinex.cpp


Ignore:
Timestamp:
Oct 6, 2006, 11:13:30 AM (18 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncrinex.cpp

    r199 r204  
    112112  QDate nextDate;
    113113
    114   if (intStr == "5 min") {
     114  int indHlp = intStr.indexOf("min");
     115
     116  if ( indHlp != -1) {
     117    int step = intStr.left(indHlp-1).toInt();
    115118    char ch = 'A' + datTim.time().hour();
    116119    hlpStr = ch;
    117     if      (datTim.time().minute() < 5) {
    118       hlpStr += "00";
    119       nextTime.setHMS(datTim.time().hour(), 5, 0);
    120       nextDate = datTim.date();
    121     }
    122     else if (datTim.time().minute() < 10) {
    123       hlpStr += "5";
    124       nextTime.setHMS(datTim.time().hour(), 10, 0);
    125       nextDate = datTim.date();
    126     }
    127     else if (datTim.time().minute() < 15) {
    128       hlpStr += "10";
    129       nextTime.setHMS(datTim.time().hour(), 15, 0);
    130       nextDate = datTim.date();
    131     }
    132     else if (datTim.time().minute() < 20) {
    133       hlpStr += "15";
    134       nextTime.setHMS(datTim.time().hour(), 20, 0);
    135       nextDate = datTim.date();
    136     }
    137     else if (datTim.time().minute() < 25) {
    138       hlpStr += "20";
    139       nextTime.setHMS(datTim.time().hour(), 25, 0);
    140       nextDate = datTim.date();
    141     }
    142     else if (datTim.time().minute() < 30) {
    143       hlpStr += "25";
    144       nextTime.setHMS(datTim.time().hour(), 30, 0);
    145       nextDate = datTim.date();
    146     }
    147     else if (datTim.time().minute() < 35) {
    148       hlpStr += "30";
    149       nextTime.setHMS(datTim.time().hour(), 35, 0);
    150       nextDate = datTim.date();
    151     }
    152     else if (datTim.time().minute() < 40) {
    153       hlpStr += "35";
    154       nextTime.setHMS(datTim.time().hour(), 40, 0);
    155       nextDate = datTim.date();
    156     }
    157     else if (datTim.time().minute() < 45) {
    158       hlpStr += "40";
    159       nextTime.setHMS(datTim.time().hour(), 45, 0);
    160       nextDate = datTim.date();
    161     }
    162     else if (datTim.time().minute() < 50) {
    163       hlpStr += "45";
    164       nextTime.setHMS(datTim.time().hour(), 50, 0);
    165       nextDate = datTim.date();
    166     }
    167     else if (datTim.time().minute() < 55) {
    168       hlpStr += "50";
    169       nextTime.setHMS(datTim.time().hour(), 55, 0);
    170       nextDate = datTim.date();
    171     }
    172     else {
    173       hlpStr += "55";
     120    if (datTim.time().minute() >= 60-step) {
     121      hlpStr += QString("%1").arg(60-step, 2, 10, QChar('0'));
    174122      if (datTim.time().hour() < 23) {
    175123        nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
     
    181129      }
    182130    }
    183   }
    184   else if (intStr == "10 min") {
    185     char ch = 'A' + datTim.time().hour();
    186     hlpStr = ch;
    187     if      (datTim.time().minute() < 10) {
    188       hlpStr += "00";
    189       nextTime.setHMS(datTim.time().hour(), 10, 0);
    190       nextDate = datTim.date();
    191     }
    192     else if (datTim.time().minute() < 20) {
    193       hlpStr += "10";
    194       nextTime.setHMS(datTim.time().hour(), 20, 0);
    195       nextDate = datTim.date();
    196     }
    197     else if (datTim.time().minute() < 30) {
    198       hlpStr += "20";
    199       nextTime.setHMS(datTim.time().hour(), 30, 0);
    200       nextDate = datTim.date();
    201     }
    202     else if (datTim.time().minute() < 40) {
    203       hlpStr += "30";
    204       nextTime.setHMS(datTim.time().hour(), 40, 0);
    205       nextDate = datTim.date();
    206     }
    207     else if (datTim.time().minute() < 50) {
    208       hlpStr += "40";
    209       nextTime.setHMS(datTim.time().hour(), 50, 0);
    210       nextDate = datTim.date();
    211     }
    212131    else {
    213       hlpStr += "50";
    214       if (datTim.time().hour() < 23) {
    215         nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
    216         nextDate = datTim.date();
    217       }
    218       else {
    219         nextTime.setHMS(0, 0, 0);
    220         nextDate = datTim.date().addDays(1);
    221       }
    222     }
    223   }
    224   else if (intStr == "15 min") {
    225     char ch = 'A' + datTim.time().hour();
    226     hlpStr = ch;
    227     if      (datTim.time().minute() < 15) {
    228       hlpStr += "00";
    229       nextTime.setHMS(datTim.time().hour(), 15, 0);
    230       nextDate = datTim.date();
    231     }
    232     else if (datTim.time().minute() < 30) {
    233       hlpStr += "15";
    234       nextTime.setHMS(datTim.time().hour(), 30, 0);
    235       nextDate = datTim.date();
    236     }
    237     else if (datTim.time().minute() < 45) {
    238       hlpStr += "30";
    239       nextTime.setHMS(datTim.time().hour(), 45, 0);
    240       nextDate = datTim.date();
    241     }
    242     else {
    243       hlpStr += "45";
    244       if (datTim.time().hour() < 23) {
    245         nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
    246         nextDate = datTim.date();
    247       }
    248       else {
    249         nextTime.setHMS(0, 0, 0);
    250         nextDate = datTim.date().addDays(1);
    251       }
    252     }
    253   }
    254   else if (intStr == "30 min") {
    255     char ch = 'A' + datTim.time().hour();
    256     hlpStr = ch;
    257     if      (datTim.time().minute() < 30) {
    258       hlpStr += "00";
    259       nextTime.setHMS(datTim.time().hour(), 30, 0);
    260       nextDate = datTim.date();
    261     }
    262     else {
    263       hlpStr += "30";
    264       if (datTim.time().hour() < 23) {
    265         nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
    266         nextDate = datTim.date();
    267       }
    268       else {
    269         nextTime.setHMS(0, 0, 0);
    270         nextDate = datTim.date().addDays(1);
     132      for (int limit = step; limit <= 60-step; limit += step) {
     133        if (datTim.time().minute() < limit) {
     134          hlpStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));
     135          nextTime.setHMS(datTim.time().hour(), limit, 0);
     136          nextDate = datTim.date();
     137          break;
     138        }
    271139      }
    272140    }
Note: See TracChangeset for help on using the changeset viewer.