/** \brief Set the FileEntry time using a DOS time. * * This function saves the specified \p dostime value as the last modification * date and time of this entry. This is generally used when reading that information * from a Zip archive. Otherwise you probably want to use the setUnixTime() * instead since it is one to one compatible with the value handle by time(), * stat(), and other OS functions. * * \param[in] dostime Set time field as is using this MSDOS date/time value. */ void FileEntry::setTime(dostime_t dostime) { setUnixTime(dos2unixtime(dostime)); }
bool NetworkWorker::sendTemp() { #ifdef LEVEL_DEBUG bool retVal = false; attemptCount++; errorPercent = ((float) (errorCount * 100)) / attemptCount; char buff[40]; sprintf(buff, "Error Percent is: %f%%", (double)errorPercent); DEBUG(buff); #endif errorCount++; INFO(F("Starting network procedure...")); if (forceConnectToServer(NETWORK_SERVER_ADDR, NETWORK_SERVER_PORT)) { unsigned long int data = gsm.getUNIXdate(); setUnixTime(data); const char * imei = gsm.getIMEI(); char pktCountStr[6]; static unsigned int pktCount = 0; sprintf(pktCountStr, "%5u", pktCount); if (!inetIface.beginWriteInet()) return false; gsm("$"); gsm(imei); gsm(","); gsm(pktCountStr); gsm(","); gsm(data); gsm(","); gsm(HWdata.getVoltage()); gsm(","); gsm(!HWdata.didHadNoVoltageSupply()); gsm(","); gsm(HWdata.didHadCaseOpen()); gsm(","); gsm(HWdata.getError()); uint16_t sensorsCount = 0, i = 0; for (; ((!_romMainBuff[i].isNull()) && (i < ROM_MAINBFF_SIZE)); i++) { double temp; gsm("\r"); gsm(_romMainBuff[i].toString()); gsm(","); for (uint8_t n = 0; n < NUM_OF_READING_ATEMPT; n++) { if (sensors.readSensor(_romMainBuff[i], temp)) { gsm(temp); sensorsCount++; break; } else if(n == NUM_OF_READING_ATEMPT - 1) gsm(-127); } } #ifdef LEVEL_INFO char charbuf[40]; sprintf(charbuf, "Num of sensors in memory: %d", i); INFO(charbuf); sprintf(charbuf, "Read sensors count: %d", sensorsCount); INFO(charbuf); #endif gsm("&"); if (inetIface.endWriteInet()) { char buf[9]; if (gsm.getString("$", "&", buf, 8)) { long int i; int flag; sscanf(buf, "%ld,%d", &i, &flag); #ifdef LEVEL_INFO sprintf(charbuf, "Package number: %ld", i); INFO(charbuf); #endif if (i == pktCount) { INFO(F("Server answered")); pktCount++; errorCount--; retVal = true; } } } } inetIface.disconnectTCP(); return retVal; }