Optional<DateTime> TOMLValue::getOpt<DateTime>() const { if (!isDateTime()) { return none; } return Optional<DateTime>(in_place, getDateTime()); }
void modCalcAzel::slotComputeCoords() { SkyPoint sp; double epoch0 = getEpoch( epochName->text() ); KStarsDateTime dt; dt.setFromEpoch( epoch0 ); long double jd = getDateTime().djd(); long double jd0 = dt.djd(); dms LST( getDateTime().gst().Degrees() + getLongitude().Degrees() ); if(radioApCoords->isChecked()) { sp = getEquCoords(); sp.apparentCoord(jd0, jd); dms lat(getLatitude()); sp.EquatorialToHorizontal( &LST, &lat ); showHorCoords( sp ); } else { sp = getHorCoords(); dms lat(getLatitude()); sp.HorizontalToEquatorial( &LST, &lat ); showEquCoords( sp ); } }
bool ldt_TAppUpdate(int argc, const char * argv[], void * data) { TAppUpdate_t request; time_t t; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], TAppUpdateArguments[i - 1]) ) return false; } i = 0; request.serviceProviderId = atoi (argv[i++]); setOptionIntValue(&request.isEntryPointIdSet, &request.entryPointId, atoi (argv[i++])); setOptionIntValue(&request.isActionSequenceNoSet, &request.actionSequenceNo, atoi (argv[i++])); t = getDateTime(argv[i++]); setOptionDateC19Value(&request.isExpiryDateSet, request.expiryDate, t); setOptionIntValue(&request.isPassengerCodeSet, &request.passengerCode, atoi (argv[i++])); t = getDateTime(argv[i++]); setOptionDateC19Value(&request.isPassengerCodeExpirySet, request.passengerCodeExpiry, t); setOptionIntValue(&request.isPassengerControlSet, &request.passengerControl, atoi (argv[i++])); setOptionIntValue(&request.isLanguageSet, &request.language, atoi (argv[i++])); if (MYKI_LDT_TAppUpdate(&request, ldtTransactionData) > 0); { return true; } return false; }
THREAD(SleepMode, arg) { struct _tm current_Time; getDateTime(¤t_Time); int temp = current_Time.tm_min; int volume = 0; setGVolume(volume); NutThreadCreate("fs", StreamMusic, NULL, 512); for (;;) { getDateTime(¤t_Time); if (temp > 45) { if (current_Time.tm_min >= temp - 45 && current_Time.tm_min < 45) { stopStream(); break; } } else { if (current_Time.tm_min >= (temp + 15)) { stopStream(); break; } } NutSleep(20000); volume+=1; setGVolume(volume); printf("test3 min:%d", current_Time.tm_min); } }
int DiagramList::readList(const SensorData* data, std::vector<DiagramList*> &lists) { const std::vector<SensorDataType::type> time_series_names (data->getTimeSeriesNames()); int nLists(time_series_names.size()); std::vector<size_t> time_steps; if (data->getStepSize()>0) { const size_t start = data->getStartTime(); const size_t end = data->getEndTime(); const size_t stepsize = data->getStepSize(); for (size_t i = start; i <= end; i+=stepsize) time_steps.push_back(i); } else time_steps = data->getTimeSteps(); bool is_date (false); if (!(BaseLib::int2date(time_steps[0])).empty()) is_date = true; size_t nValues (time_steps.size()); for (int i = 0; i < nLists; i++) { DiagramList* l = new DiagramList; l->setName(QString::fromStdString(SensorData::convertSensorDataType2String(time_series_names[i]))); l->setXLabel("Time"); lists.push_back(l); const std::vector<float> *time_series = data->getTimeSeries(time_series_names[i]); if (is_date) { l->setXUnit("day"); QDateTime startDate(getDateTime(QString::fromStdString(BaseLib::int2date(time_steps[0])))); lists[i]->setStartDate(startDate); int numberOfSecs(0); for (size_t j = 0; j < nValues; j++) { numberOfSecs = startDate.secsTo(getDateTime(QString::fromStdString(BaseLib::int2date(time_steps[j])))); lists[i]->addNextPoint(numberOfSecs, (*time_series)[j]); } } else { l->setXUnit("time step"); for (size_t j = 0; j < nValues; j++) lists[i]->addNextPoint(time_steps[j], (*time_series)[j]); } lists[i]->update(); } return nLists; }
bool ldt_productSale(int argc, const char * argv[], void *data) { ProductSale_t request; int ret; int i; CsDebug(9, (9, "ldt_productSale")); LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], ProductSaleArguments[i]) ) return false; } i = 0; request.productId = atoi (argv[i++]); request.issuerId = atoi (argv[i++]); request.purchaseValue = atoi (argv[i++]); request.zoneLow = atoi (argv[i++]); request.zoneHigh = atoi (argv[i++]); request.startDateTime = getDateTime (argv[i++]); request.endDateTime = getDateTime (argv[i++]); request.serviceProviderId = atoi (argv[i++]); setOptionIntValue(&request.isActionSequenceNoSet, &request.actionSequenceNo, atoi (argv[i++])); setOptionIntValue(&request.isEntryPointIdSet, &request.entryPointId, atoi (argv[i++])); setOptionIntValue(&request.isRouteIdSet, &request.routeId, atoi (argv[i++])); setOptionIntValue(&request.isStopIdSet, &request.stopId, atoi (argv[i++])); setOptionIntValue(&request.isAutoloadSet, &request.isAutoload, atoi (argv[i++])); setOptionIntValue(&request.isOffpeakSet, &request.isOffpeak, atoi (argv[i++])); setOptionIntValue(&request.isProvisionalSet, &request.isProvisional, atoi (argv[i++])); setOptionIntValue(&request.isInstanceCountSet, &request.instanceCount, atoi (argv[i++])); ret = MYKI_LDT_ProductSale(&request, ldtTransactionData); if (ret == LDT_SUCCESS) { CsDebug(9, (9, "LDTcmd:ldt_productSale: Successfully called MYKI_LDT_ProductSale" )); return true; } else if (ret == LDT_PRECONDITION_NOT_MET) { CsErrx("LDTcmd:ldt_productSale: Failed to call MYKI_LDT_ProductSale due to precondition not met"); } else { CsErrx("LDTcmd:ldt_productSale: Failed to call MYKI_LDT_ProductSaleReverse"); } return false; }
bool ldt_productSaleUpgrade(int argc, const char * argv[], void *data) { ProductSale_t request; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], ProductSaleUpgradeArguments[i - 1]) ) return false; } i = 0; request.serialNo = atoi (argv[i++]); request.productId = atoi (argv[i++]); request.purchaseValue = atoi (argv[i++]); request.zoneLow = atoi (argv[i++]); request.zoneHigh = atoi (argv[i++]); if (!strcmp(argv[i], UNKNOWN_VALUE_STR) == 0) { time_t t = getDateTime(argv[i]); setOptionDateTimeValue(&request.isStartDateTimeSet, request.startDateTime, t); } i++; if (!strcmp(argv[i], UNKNOWN_VALUE_STR) == 0) { time_t t = getDateTime(argv[i]); setOptionDateTimeValue(&request.isEndDateTimeSet, request.endDateTime, t); } i++; setOptionIntValue(&request.isProvisionalSet, &request.isProvisional, atoi (argv[i++])); request.serviceProviderId = atoi (argv[i++]); setOptionIntValue(&request.isEntryPointIdSet, &request.entryPointId, atoi (argv[i++])); setOptionIntValue(&request.isRouteIdSet, &request.routeId, atoi (argv[i++])); setOptionIntValue(&request.isStopIdSet, &request.stopId, atoi (argv[i++])); if (MYKI_LDT_ProductSaleUpgrade(&request, ldtTransactionData) > 0); { return true; } return false; }
//创建销售商品信息的节点 void Widget::createNodes(QDomElement &date) { QDomElement time=doc.createElement(QString("日期")); QDomAttr curTime=doc.createAttribute("time"); curTime.setValue(getDateTime(Time)); time.setAttributeNode(curTime); date.appendChild(time); QDomElement type=doc.createElement(QString("类型")); QDomElement brand=doc.createElement(QString("品牌")); QDomElement price=doc.createElement(QString("单价")); QDomElement num=doc.createElement(QString("数量")); QDomElement sum=doc.createElement(QString("金额")); QDomText text; text=doc.createTextNode(QString("%1") .arg(ui->sellTypeComboBox->currentText())); type.appendChild(text); text=doc.createTextNode(QString("%1") .arg(ui->sellBrandComboBox->currentText())); brand.appendChild(text); text=doc.createTextNode(QString("%1") .arg(ui->sellPriceLineEdit->text())); price.appendChild(text); text=doc.createTextNode(QString("%1") .arg(ui->sellNumSpinBox->value())); num.appendChild(text); text=doc.createTextNode(QString("%1") .arg(ui->sellSumLineEdit->text())); sum.appendChild(text); time.appendChild(text); time.appendChild(type); time.appendChild(brand); time.appendChild(price); time.appendChild(num); time.appendChild(sum); }
QScriptValue NetworkAutomaticProxy::weekdayRange(QScriptContext *context, QScriptEngine *engine) { Q_UNUSED(engine); if (context->argumentCount() < 1 || context->argumentCount() > 3) { return context->throwError(QLatin1String("Function weekdayRange takes 1 to 3 arguments!")); } const QString beginDay = context->argument(0).toString().toLower(); const QString endDay = context->argument(1).toString().toLower(); const int currentDay = getDateTime(context).date().dayOfWeek(); int beginDayNumber = -1; int endDayNumber = -1; for (int i = 0; i < m_days.count(); ++i) { if (beginDay == m_days.at(i)) { beginDayNumber = (i + 1); } if (endDay == m_days.at(i)) { endDayNumber = (i + 1); } } if (endDayNumber == -1) { endDayNumber = beginDayNumber; } return ((beginDayNumber != -1 && endDayNumber != -1) && compareRange(beginDayNumber, endDayNumber, currentDay)); }
bool ldt_productUsageForceScanOff(int argc, const char * argv[], void * data) { ProductUsage_t request; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], ProductUsageScanOffArguments[i - 1]) ) return false; } i = 0; request.serialNo = atoi (argv[i++]); request.serviceProviderId = atoi (argv[i++]); request.entryPointId = atoi (argv[i++]); request.routeId = atoi (argv[i++]); request.stopId = atoi (argv[i++]); request.zone = atoi (argv[i++]); request.dateTime = getDateTime (argv[i++]); setOptionIntValue(&request.isOriginatingServiceProviderIdSet, &request.originatingServiceProviderId, atoi (argv[i++])); setOptionIntValue(&request.isOriginatingEntryPointIdSet, &request.originatingEntryPointId, atoi (argv[i++])); setOptionIntValue(&request.isOriginatingRouteIdSet, &request.originatingRouteId, atoi (argv[i++])); setOptionIntValue(&request.isOriginatingStopIdSet, &request.originatingStopId, atoi (argv[i++])); if (MYKI_LDT_ProductUsageForceScanOff(&request, ldtTransactionData) > 0); { return true; } return false; }
bool ldt_productUsageScanOnEpass(int argc, const char * argv[], void * data) { ProductUsage_t request; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], ProductUsageScanOnArguments[i - 1]) ) return false; } i = 0; request.serialNo = atoi (argv[i++]); request.serviceProviderId = atoi (argv[i++]); request.entryPointId = atoi (argv[i++]); request.routeId = atoi (argv[i++]); request.stopId = atoi (argv[i++]); request.zone = atoi (argv[i++]); request.dateTime = getDateTime (argv[i++]); if (MYKI_LDT_ProductUsageScanOnEpass(&request, ldtTransactionData) > 0); { return true; } return false; }
bool ldt_CappingUpdate(int argc, const char * argv[], void * data) { CappingUpdate_t request; time_t t; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], CappingUpdateArguments[i - 1]) ) return false; } i = 0; request.serviceProviderId = atoi (argv[i++]); setOptionIntValue(&request.isEntryPointIdSet, &request.entryPointId, atoi (argv[i++])); t = getDateTime(argv[i++]); setOptionDateC19Value(&request.isDailyExpirySet, request.dailyExpiry, t); setOptionIntValue(&request.isDailyZoneLowSet, &request.dailyZoneLow, atoi (argv[i++])); setOptionIntValue(&request.isDailyZoneHighSet, &request.dailyZoneHigh, atoi (argv[i++])); setOptionIntValue(&request.isDailyValueSet, &request.dailyValue, atoi (argv[i++])); setOptionIntValue(&request.isWeeklyExpirySet, &request.weeklyExpiry, atoi (argv[i++])); setOptionIntValue(&request.isWeeklyZoneHighSet, &request.weeklyZoneHigh, atoi (argv[i++])); setOptionIntValue(&request.isWeeklyValueSet, &request.weeklyValue, atoi (argv[i++])); if (MYKI_LDT_CappingUpdate(&request, ldtTransactionData) > 0); { return true; } }
void output_saveResults(double reportTime) // // Input: reportTime = elapsed simulation time (millisec) // Output: none // Purpose: writes computed results for current report time to binary file. // { int i; DateTime reportDate = getDateTime(reportTime); REAL8 date; if ( reportDate < ReportStart ) return; for (i=0; i<MAX_SYS_RESULTS; i++) SysResults[i] = 0.0f; date = reportDate; fwrite(&date, sizeof(REAL8), 1, Fout.file); if (Nobjects[SUBCATCH] > 0) output_saveSubcatchResults(reportTime, Fout.file); if (Nobjects[NODE] > 0) output_saveNodeResults(reportTime, Fout.file); if (Nobjects[LINK] > 0) output_saveLinkResults(reportTime, Fout.file); fwrite(SysResults, sizeof(REAL4), MAX_SYS_RESULTS, Fout.file); if ( Foutflows.mode == SAVE_FILE && RouteModel != NO_ROUTING ) //(5.0.014 - LR) iface_saveOutletResults(reportDate, Foutflows.file); Nperiods++; }
void sendError(int sock, int code) { char* responseFormat = NULL; switch (code) { case 400: responseFormat = "HTTP/1.1 400 Bad Request\nServer: newServerinc\nDate: %s\n\n400 Bad Request\n\n"; break; case 403: responseFormat = "HTTP/1.1 403 Forbidden\nServer: newServerinc\nDate: %s\n\n403 Forbidden\n\n"; break; case 404: responseFormat = "HTTP/1.1 404 Not Found\nServer: newServerinc\nDate: %s\n\n404 Not Found\n\n"; break; default: responseFormat = "HTTP/1.1 400 Bad Request\nServer: newServerinc\nDate: %s\n\n400 Bad Request\n\n"; break; } char* dateTime = getDateTime(); char* response = calloc(strlen(responseFormat) + strlen(dateTime)-1,sizeof(char)); sprintf(response,responseFormat, dateTime); write(sock , response , strlen(response)); shutdown(sock,SHUT_RDWR); close(sock); free(response); free(dateTime); }
// 将销售记录写入文档 void Widget::writeXml() { // 先从文件读取 if (docRead()) { QString currentDate = getDateTime(Date); QDomElement root = doc.documentElement(); // 根据是否有日期节点进行处理 if (!root.hasChildNodes()) { QDomElement date = doc.createElement(QString("日期")); QDomAttr curDate = doc.createAttribute("date"); curDate.setValue(currentDate); date.setAttributeNode(curDate); root.appendChild(date); createNodes(date); } else { QDomElement date = root.lastChild().toElement(); // 根据是否已经有今天的日期节点进行处理 if (date.attribute("date") == currentDate) { createNodes(date); } else { QDomElement date = doc.createElement(QString("日期")); QDomAttr curDate = doc.createAttribute("date"); curDate.setValue(currentDate); date.setAttributeNode(curDate); root.appendChild(date); createNodes(date); } } // 写入到文件 docWrite(); } }
CNetwork::CNetwork(const CString &input_traf_file_name) : CObject() , m_network_name("") , m_traf_input_file(input_traf_file_name) , m_sensors_output_file("") , m_out_type(NO) , m_link_list() , m_node_list() , m_tp_lengths() { char buff[DTTMSZ]; char path_buffer[_MAX_PATH]; char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char base_name[_MAX_FNAME]; errno_t err; err = _splitpath_s(m_traf_input_file, drive, _MAX_DRIVE, dir, _MAX_DIR, base_name, _MAX_FNAME, NULL, NULL); if (err != 0) { printf("Error splitting the path. Error code %d.\n", err); exit(1); } err = _makepath_s(path_buffer, _MAX_PATH, drive, dir, base_name, NULL); if (err != 0) { printf("Error creating path. Error code %d.\n", err); exit(1); } m_sensors_output_file = path_buffer; m_sensors_output_file += _T(getDateTime(buff)); m_sensors_cum_output_file = m_sensors_output_file; }
double landuse_getExternalBuildup(Project* project, int i, int p, double buildup, double tStep) // // Input: i = landuse index // p = pollutant index // buildup = buildup at start of time step (mass/unit) // tStep = time step (sec) // Output: returns pollutant buildup at end of time interval (mass/unit) // Purpose: finds pollutant buildup contributed by external loading over a // given time step. // { double maxBuildup = project->Landuse[i].buildupFunc[p].coeff[0]; double sf = project->Landuse[i].buildupFunc[p].coeff[1]; // scaling factor int ts = (int)floor(project->Landuse[i].buildupFunc[p].coeff[2]); // time series index double rate = 0.0; // --- no buildup increment at start of simulation if (project->NewRunoffTime == 0.0) return 0.0; // --- get buildup rate (mass/unit/day) over the interval if ( ts >= 0 ) { rate = sf * table_tseriesLookup(&project->Tseries[ts], getDateTime(project, project->NewRunoffTime), FALSE); } // --- compute buildup at end of time interval buildup = buildup + rate * tStep / SECperDAY; buildup = MIN(buildup, maxBuildup); return buildup; }
void output_saveResults(Project* project, double reportTime) // // Input: reportTime = elapsed simulation time (millisec) // Output: none // Purpose: writes computed results for current report time to binary file. // { int i; DateTime reportDate = getDateTime(project,reportTime); REAL8 date; if ( reportDate < project->ReportStart ) return; for (i=0; i<MAX_SYS_RESULTS; i++) project->SysResults[i] = 0.0f; date = reportDate; fwrite(&date, sizeof(REAL8), 1, project->Fout.file); if (project->Nobjects[SUBCATCH] > 0) output_saveSubcatchResults(project,reportTime, project->Fout.file); if (project->Nobjects[NODE] > 0) output_saveNodeResults(project,reportTime, project->Fout.file); if (project->Nobjects[LINK] > 0) output_saveLinkResults(project,reportTime, project->Fout.file); fwrite(project->SysResults, sizeof(REAL4), MAX_SYS_RESULTS, project->Fout.file); if ( project->Foutflows.mode == SAVE_FILE && !project->IgnoreRouting ) iface_saveOutletResults(project,reportDate, project->Foutflows.file); project->Nperiods++; }
ext::string OptionsCtrl::getDateTimeStr(HANDLE hDateTime) { bool bNone = false; DWORD dwTimestamp = getDateTime(hDateTime, &bNone); return bNone ? _T("") : utils::formatDate(dwTimestamp); }
///////////////////////////////////////////////// ///Отправка данных в БД и на удаленный сервер ///////////////////////////////////////////////// void DataBase::sendGPSPICNow(QStringList GPS, QStringList PIC) { QSqlQuery query; dataTrans = getDateTime(); if (GPS.size()==0) {GPS.append("fail");} if (PIC.size()==0) {PIC.append("fail");} //отправка кординат в таблицу GPS if (GPS[0]!="fail") { query.exec("insert into vehicle_"+idmain+" values('"+ dataTrans+"',"+GPS[2]+","+GPS[3]+"," +"'false'"+","+idmain+",'"+GPS[0]+"', '"+GPS[1]+"')");} //отправка показаний датчиков в таблицу PIC if (PIC[0]!="fail") { query.exec( "INSERT INTO vehicle_pic_"+idmain+" (an, led, pot, temp, id, data,send)"+ "VALUES ('{"+PIC[0]+"}', '{"+PIC[1]+"}', "+PIC[2]+","+PIC[3]+", "+idmain+", '"+ dataTrans+"','false')"); } //отправка кординат и показаний датчиков на удвленный сервер rpcclient.sendNow(GPS,PIC,idmain,dataTrans); // ждем и молимся }
void terrama2::core::DataStoragerTiff::store(DataSetSeries series, DataSetPtr outputDataSet) const { if(!outputDataSet.get() || !series.syncDataSet.get()) { QString errMsg = QObject::tr("Mandatory parameters not provided."); TERRAMA2_LOG_ERROR() << errMsg; throw DataStoragerException() << ErrorDescription(errMsg); } QUrl uri(QString::fromStdString(dataProvider_->uri)); auto path = uri.path().toStdString(); try { std::string mask = getMask(outputDataSet); auto dataset = series.syncDataSet->dataset(); size_t rasterColumn = te::da::GetFirstPropertyPos(dataset.get(), te::dt::RASTER_TYPE); if(!isValidColumn(rasterColumn)) { QString errMsg = QObject::tr("No raster attribute."); TERRAMA2_LOG_ERROR() << errMsg; throw DataStoragerException() << ErrorDescription(errMsg); } size_t timestampColumn = te::da::GetFirstPropertyPos(dataset.get(), te::dt::DATETIME_TYPE); dataset->moveBeforeFirst(); while(dataset->moveNext()) { std::shared_ptr<te::rst::Raster> raster(dataset->isNull(rasterColumn) ? nullptr : dataset->getRaster(rasterColumn).release()); std::shared_ptr<te::dt::DateTime> timestamp; if(!isValidColumn(timestampColumn) || dataset->isNull(timestampColumn)) timestamp = nullptr; else timestamp.reset(dataset->getDateTime(timestampColumn).release()); if(!raster.get()) { QString errMsg = QObject::tr("Null raster found."); TERRAMA2_LOG_ERROR() << errMsg; continue; } std::string filename = replaceMask(mask, timestamp, outputDataSet); std::string output = path + "/" + filename; te::rp::Copy2DiskRaster(*raster, output); } } catch(const DataStoragerException&) { throw; } catch(...) { //TODO: fix DataStoragerTiff catch } }
bool CAsyncLog::write(const std::string& sMsg) { if(!writeBuffer("[" + getDateTime() + "]" + sMsg)) { return false; } return true; }
bool ldt_productUpdateExtend(int argc, const char * argv[], void * data) { ProductUpdate_t request; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], ProductUpdateExtendArguments[i - 1]) ) return false; } i = 0; request.serialNo = atoi (argv[i++]); request.serviceProviderId = atoi (argv[i++]); setOptionIntValue(&request.isEntryPointIdSet, &request.entryPointId, atoi (argv[i++])); setOptionIntValue(&request.isZoneLowSet, &request.zoneLow, atoi (argv[i++])); setOptionIntValue(&request.isZoneHighSet, &request.zoneHigh, atoi (argv[i++])); setOptionIntValue(&request.isPurchaseValueSet, &request.purchaseValue, atoi (argv[i++])); if (!strcmp(argv[i], UNKNOWN_VALUE_STR) == 0) { time_t t = getDateTime(argv[i]); setOptionDateTimeValue(&request.isStartDateTimeSet, request.startDateTime, t); } i++; if (!strcmp(argv[i], UNKNOWN_VALUE_STR) == 0) { time_t t = getDateTime(argv[i]); setOptionDateTimeValue(&request.isEndDateTimeSet, request.endDateTime, t); } i++; setOptionIntValue(&request.isInstanceCountSet, &request.instanceCount, atoi (argv[i++])); setOptionIntValue(&request.isPremiumSet, &request.isPremium, atoi (argv[i++])); setOptionIntValue(&request.isClearBorderStatusSet, &request.clearBorderStatus, atoi (argv[i++])); if (MYKI_LDT_ProductUpdateExtend(&request, ldtTransactionData) > 0); { return true; } return false; }
void andrq::loadMessages(const QString &path) { QDir dir = path; QString account = dir.dirName(); if(!dir.cd("history")) return; setProtocol("ICQ"); setAccount(account); QFileInfoList files = dir.entryInfoList(QDir::Files); setMaxValue(files.size()); for(int i = 0; i < files.size(); i++) { setValue(i + 1); QString uin = files[i].fileName(); QFile file(files[i].absoluteFilePath()); if(!file.open(QFile::ReadOnly)) continue; setContact(uin); QDataStream in(&file); in.setByteOrder(QDataStream::LittleEndian); Message message; message.type=1; while(!in.atEnd()) { qint32 type; in >> type; switch(type) { case -1: { quint8 kind; qint32 who; in >> kind >> who; QString from = QString::number(who); message.in = from == uin; message.time = getDateTime(in); qint32 tmp; in >> tmp; in.skipRawData(tmp); message.text = Qt::escape(getString(in, who)).replace("\n", "<br/>"); if(kind==1) appendMessage(message); break; } case -2: { qint32 tmp; in >> tmp; in.skipRawData(tmp); break; } case -3: in.skipRawData(5); break; default: break; } } } }
void urinalysis::setForms(int row, int) { if(row < 0 || row >= m_currentTableIndexInAll.size()) { return; } int index = m_currentTableIndexInAll[row]; urinalysisInfo &info = m_allInfoVec[index]; ui->nameLineEdit->setText(info.name); if(info.sex == "男") { ui->maleRadioButton->setChecked(true); } else { ui->femaleRadioButton->setChecked(true); } ui->ageComboBox->setCurrentText(QString::number(info.age)); ui->patientIDLineEdit->setText(info.patientID); ui->sampleIDLineEdit->setText(QString::number(info.sampleID)); ui->sampleTypeLineEdit->setText(info.sampleType); ui->officeLineEdit->setText(info.administrativeOffice.trimmed()); ui->senderDoctorLineEdit->setText(info.senderDoctor.trimmed()); ui->sampleDateEdit->setDateTime(getDateTime(info.sampleDate)); ui->detectionDateEdit->setDateTime(getDateTime(info.detectionDate)); ui->bedIDLineEdit->setText(QString::number(info.bedID)); ui->ALBLineEdit->setText(QString::number(info.ALB)); ui->CRELineEdit->setText(QString::number(info.CRE)); ui->prooferLineEdit->setText(info.proofer.trimmed()); ui->auditorLineEdit->setText(info.auditor.trimmed()); ui->reportDateEdit->setDateTime(getDateTime(info.reportDate)); ui->remarksLineEdit->setText("本报告仅对此次送检标本负责。"); }
void Widget::example(){ QString text = tr("example"); if(isRename()){ if(isNewName()){ text = getNewName(); } if(isPrependExifDate()){ text.prepend(getDateTime("").toString(ui->exifLineEdit->text())); } if(isAppendExifDate()){ text.append(getDateTime("").toString(ui->exifLineEdit->text())); } if(!(getPrefix().isEmpty() && getSuffix().isEmpty())){ text.prepend(getPrefix()); text.append(getSuffix()); } } ui->exampleLabel->setText(text); }
void modCalcDayLength::slotComputePosTime() { long double jd0 = getDateTime().djd(); getGeoLocation(); KSNumbers * num = new KSNumbers(jd0); KSSun *Sun = new KSSun(((KStars*) parent()->parent()->parent())->data()); Sun->findPosition(num); QTime setQtime = Sun->riseSetTime( jd0 , geoPlace, false ); QTime riseQtime = Sun->riseSetTime( jd0 , geoPlace, true ); QTime transitQtime = Sun->transitTime(jd0 , geoPlace); dms setAz = Sun->riseSetTimeAz(jd0, geoPlace, false); dms riseAz = Sun->riseSetTimeAz(jd0, geoPlace, true); dms transAlt = Sun->transitAltitude(jd0, geoPlace); if (setQtime.isValid() ) { azSetBox->show( setAz ); elTransitBox->show( transAlt ); azRiseBox->show( riseAz ); setTimeBox->showTime( setQtime ); riseTimeBox->showTime( riseQtime ); transitTimeBox->showTime( transitQtime ); QTime dayLQtime = lengthOfDay (setQtime,riseQtime); dayLBox->showTime( dayLQtime ); } else if (transAlt.Degrees() > 0. ) { azSetBox->setDMS(i18n("Circumpolar")); elTransitBox->show( transAlt ); azRiseBox->setDMS(i18n("Circumpolar")); setTimeBox->showTime( setQtime ); riseTimeBox->showTime( riseQtime ); transitTimeBox->showTime( transitQtime ); dayLBox->setEntry("24:00:00"); } else if (transAlt.Degrees() < 0. ) { azSetBox->setDMS("does not rise"); elTransitBox->setDMS("does not rise"); azRiseBox->setDMS("does not rise"); setTimeBox->clearFields(); riseTimeBox->clearFields(); transitTimeBox->clearFields(); dayLBox->showTime( QTime(0,0,0) ); } delete num; }
bool ldt_productUpdateActivate(int argc, const char * argv[], void * data) { ProductUpdate_t request; int i; LDTTransactionData_t *ldtTransactionData = (LDTTransactionData_t *)data; for (i = 0; i < argc; i++) { if ( !isValid(argv[i], ProductUpdateActivateArguments[i - 1]) ) return false; } i = 0; request.serialNo = atoi (argv[i++]); request.serviceProviderId = atoi (argv[i++]); request.entryPointId = atoi (argv[i++]); request.routeId = atoi (argv[i++]); request.stopId = atoi (argv[i++]); setOptionIntValue(&request.isInstanceCountSet, &request.instanceCount, atoi (argv[i++])); if (!strcmp(argv[i], UNKNOWN_VALUE_STR) == 0) { time_t t = getDateTime(argv[i]); setOptionDateTimeValue(&request.isStartDateTimeSet, request.startDateTime, t); } i++; if (!strcmp(argv[i], UNKNOWN_VALUE_STR) == 0) { time_t t = getDateTime(argv[i]); setOptionDateTimeValue(&request.isEndDateTimeSet, request.endDateTime, t); } i++; if (MYKI_LDT_ProductUpdateActivate(&request, ldtTransactionData) > 0); { return true; } return false; }
int SetEvent::exec() { int r; do { r = SetEventBase::exec(); if (r) { if ((!IgnoreTime->isChecked() && !getDateTime().isValid()) || (IgnoreTime->isChecked() && !getDateTime().date().isValid())) { QMessageBox::warning(this, "Datetime is invalid", "Please, enter the valid datetime."); } else return r; } else return r; } while (1); }
void getEvapRates(Project* project, double theta, double upperDepth) // // Input: theta = moisture content of upper zone // upperDepth = depth of upper zone (ft) // Output: none // Purpose: computes evapotranspiration out of upper & lower zones. // { int p, month; double f; double lowerFrac, upperFrac; // --- no project->GW evaporation when infiltration is occurring project->UpperEvap = 0.0; project->LowerEvap = 0.0; if ( project->Infil > 0.0 ) return; // --- get monthly-adjusted upper zone evap fraction upperFrac = project->A.upperEvapFrac; f = 1.0; p = project->A.upperEvapPat; if ( p >= 0 ) { month = datetime_monthOfYear(getDateTime(project,project->NewRunoffTime)); f = project->Pattern[p].factor[month-1]; } upperFrac *= f; // --- upper zone evaporation requires that soil moisture // be above the wilting point if ( theta > project->A.wiltingPoint ) { // --- actual evap is upper zone fraction applied to max. potential // rate, limited by the available rate after any surface evap project->UpperEvap = upperFrac * project->MaxEvap; project->UpperEvap = MIN(project->UpperEvap, project->AvailEvap); } // --- check if lower zone evaporation is possible if ( project->A.lowerEvapDepth > 0.0 ) { // --- find the fraction of the lower evaporation depth that // extends into the saturated lower zone lowerFrac = (project->A.lowerEvapDepth - upperDepth) / project->A.lowerEvapDepth; lowerFrac = MAX(0.0, lowerFrac); lowerFrac = MIN(lowerFrac, 1.0); // --- make the lower zone evap rate proportional to this fraction // and the evap not used in the upper zone project->LowerEvap = lowerFrac * (1.0 - upperFrac) * project->MaxEvap; project->LowerEvap = MIN(project->LowerEvap, (project->AvailEvap - project->UpperEvap)); } }