A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: tcp/http/httpsend.c
- Revision:
- 127:fcdfbfad8770
- Parent:
- 96:43eb7a110f1a
- Child:
- 135:a7f026a09543
--- a/tcp/http/httpsend.c Mon Feb 25 20:59:19 2019 +0000 +++ b/tcp/http/httpsend.c Fri Mar 08 18:43:56 2019 +0000 @@ -1,3 +1,4 @@ +#include <time.h> #include "tcpbuf.h" void HttpAddChar (char c) { TcpBufAddChar(c); } @@ -36,3 +37,22 @@ HttpAddNibbleAsHex(value >> 4); HttpAddNibbleAsHex(value >> 0); } +void HttpAddTm(struct tm* ptm) +{ + HttpAddF("%d-%02d-%02d ", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday); + switch(ptm->tm_wday) + { + case 0: HttpAddText("Sun"); break; + case 1: HttpAddText("Mon"); break; + case 2: HttpAddText("Tue"); break; + case 3: HttpAddText("Wed"); break; + case 4: HttpAddText("Thu"); break; + case 5: HttpAddText("Fri"); break; + case 6: HttpAddText("Sat"); break; + default: HttpAddText("???"); break; + } + HttpAddF(" %02d:%02d:%02d", ptm->tm_hour, ptm->tm_min, ptm->tm_sec); + if (ptm->tm_isdst > 0) HttpAddText(" BST"); + else if (ptm->tm_isdst == 0) HttpAddText(" GMT"); + else HttpAddText(" UTC"); +}