@@ -916,6 +916,26 @@ int getTime(const uint8_t command[], uint8_t response[])
916916 return 5 + sizeof (now);
917917}
918918
919+ int setTime (const uint8_t command[], uint8_t response[])
920+ {
921+ // [0] CMD_START < 0xE0 >
922+ // [1] Command < 1 byte >
923+ // [2] N args < 1 byte >
924+ // [3] time size < 1 byte >
925+ // [4] time < 4 byte >
926+ time_t unixtime;
927+ memcpy (&unixtime, &command[4 ], sizeof (unixtime));
928+
929+ timeval epoch = {unixtime, 0 };
930+ int ret = settimeofday ((const timeval*)&epoch, 0 );
931+
932+ response[2 ] = 1 ; // number of parameters
933+ response[3 ] = 1 ; // parameter 1 length
934+ response[4 ] = ret;
935+
936+ return 6 ;
937+ }
938+
919939int getIdxBSSID (const uint8_t command[], uint8_t response[])
920940{
921941 uint8_t bssid[6 ];
@@ -2165,7 +2185,7 @@ const CommandHandlerType commandHandlers[] = {
21652185 setEnt, NULL , NULL , NULL , sendDataTcp, getDataBufTcp, insertDataBuf, NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL ,
21662186
21672187 // 0x50 -> 0x5f
2168- setPinMode, setDigitalWrite, setAnalogWrite, getDigitalRead, getAnalogRead, NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL ,
2188+ setPinMode, setDigitalWrite, setAnalogWrite, getDigitalRead, getAnalogRead, setTime , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL ,
21692189
21702190 // 0x60 -> 0x6f
21712191 writeFile, readFile, deleteFile, existsFile, downloadFile, applyOTA, renameFile, downloadOTA, brSetECTrustAnchor, brErrorCode, NULL , NULL , NULL , NULL , NULL , NULL ,
0 commit comments