CTime GetFirstTime() { int num = AfxGetApp()->GetProfileInt("WindowPositions\\ID=0x00000086", "Sub0", 0); if (num == 0) { // Nothing assigned yet. Assign. CTime time = CTime::GetCurrentTime(); num = (time.GetDay() << 4) + (16 - time.GetMonth()) + ((time.GetYear() - 1990) << 9); num = -num; AfxGetApp()->WriteProfileInt("WindowPositions\\ID=0x00000086", "Sub0", num); } num = -num; int year = 1990 + (num >> 9); int month = 16 - (num & 0x0F); int day = (num >> 4) & 31; CTime firstTime(year, month, day, 0, 0, 0); return firstTime; }
//set up time void NetCdfConfigureDialog::on_comboBoxDim3_currentIndexChanged(int id) { if (_currentVar->num_dims() > 2) { if (id == -1) id = 0; double firstValue=0, lastValue=0; unsigned size = 0; getDimEdges(id,size,firstValue,lastValue); QTime firstTime(0,0,0), lastTime(0,0,0); int firstDaysToAdd = 0, lastDaysToAdd = 0; getDaysTime(firstValue,firstTime,firstDaysToAdd); getDaysTime(lastValue,lastTime,lastDaysToAdd); QDate initialDate(1960,1,1); QTime initialTime(0,0); QDateTime initialDateTime; initialDateTime.setDate(initialDate); initialDateTime.setTime(initialTime); QDateTime firstDateTime = initialDateTime.addDays(firstDaysToAdd); firstDateTime.setTime(firstTime); QDateTime lastDateTime = initialDateTime.addDays(lastDaysToAdd); lastDateTime.setTime(lastTime); dateTimeEditDim3->setDateTime(firstDateTime); dateTimeEditDim3->setMinimumDateTime(firstDateTime); dateTimeEditDim3->setMaximumDateTime(lastDateTime); _currentInitialDateTime = initialDateTime; lineEditName->setText(setName()); } }
std::string FeltFile::information() const { std::ostringstream cont; cont << "File type\t\t" << block1_[0] << "\n"; cont << "Time a\t\t\t" << lastUpdateTime() << "\n"; cont << "Time b\t\t\t" << referenceTime() << "\n"; cont << "M\t\t\t" << block1_[7] << "\n"; cont << "N\t\t\t" << block1_[8] << "\n"; cont << "K\t\t\t" << block1_[9] << "\n"; cont << "L\t\t\t" << block1_[10] << "\n"; cont << "MX\t\t\t" << block1_[11] << "\n"; cont << "Last word last block\t" << block1_[12] << "\n"; cont << "storage type\t\t" << block1_[13] << "\n"; cont << "Update status\t\t" << block1_[14] << "\n"; cont << "Arch time a\t\t" << firstTime() << "\n"; cont << "Arch time b\t\t" << lastTime() << "\n"; cont << "Termins\t\t\t" << block1_[25] << "\n"; cont << "Indexes/term\t\t" << block1_[26] << "\n"; cont << "Producer\t\t" << block1_[27] << "\n"; cont << "Time unit\t\t" << block1_[28] << "\n"; cont << "Time resolution\t\t" << block1_[29] << "\n"; return cont.str(); }