| 1772 | // terminated by a space and followed by name of file |
| 1773 | |
| 1774 | uint8_t FtpServer::getDateTime(char* dt, uint16_t* pyear, uint8_t* pmonth, uint8_t* pday, uint8_t* phour, |
| 1775 | uint8_t* pminute, uint8_t* psecond) |
| 1776 | { |
| 1777 | uint8_t i; |
| 1778 | dt[0] = 0; |
| 1779 | if(strlen(parameter) < 15) //|| parameter[ 14 ] != ' ' ) |
| 1780 | return 0; |
| 1781 | for(i = 0; i < 14; i++) |
| 1782 | if(!isdigit(parameter[i])) return 0; |
| 1783 | for(i = 14; i < 18; i++) |
| 1784 | if(parameter[i] == ' ') |
| 1785 | break; |
| 1786 | else if(!isdigit(parameter[i])) |
| 1787 | return 0; |
| 1788 | if(i == 18) return 0; |
| 1789 | i++; |
| 1790 | |
| 1791 | strncpy(dt, parameter, 14); |
| 1792 | dt[14] = 0; |
| 1793 | *psecond = atoi(dt + 12); |
| 1794 | dt[12] = 0; |
| 1795 | *pminute = atoi(dt + 10); |
| 1796 | dt[10] = 0; |
| 1797 | *phour = atoi(dt + 8); |
| 1798 | dt[8] = 0; |
| 1799 | *pday = atoi(dt + 6); |
| 1800 | dt[6] = 0; |
| 1801 | *pmonth = atoi(dt + 4); |
| 1802 | dt[4] = 0; |
| 1803 | *pyear = atoi(dt); |
| 1804 | strncpy(dt, parameter, 14); |
| 1805 | DEBUG_PRINT(F(" Modification time: ")); |
| 1806 | DEBUG_PRINT(*pyear); |
| 1807 | DEBUG_PRINT(F("/")); |
| 1808 | DEBUG_PRINT(int(*pmonth)); |
| 1809 | DEBUG_PRINT(F("/")); |
| 1810 | DEBUG_PRINT(int(*pday)); |
| 1811 | DEBUG_PRINT(F(" ")); |
| 1812 | DEBUG_PRINT(int(*phour)); |
| 1813 | DEBUG_PRINT(F(":")); |
| 1814 | DEBUG_PRINT(int(*pminute)); |
| 1815 | DEBUG_PRINT(F(":")); |
| 1816 | DEBUG_PRINT(int(*psecond)); |
| 1817 | DEBUG_PRINT(F(" of file: ")); |
| 1818 | DEBUG_PRINTLN((char*)(parameter + i)); |
| 1819 | |
| 1820 | return i; |
| 1821 | } |
| 1822 | |
| 1823 | // Create string YYYYMMDDHHMMSS from date and time |
| 1824 | // |
nothing calls this directly
no outgoing calls
no test coverage detected