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/httpdate.cpp
- Revision:
- 49:1a6336f2b3f9
- Parent:
- 22:914b970356f0
diff -r 952dddb74b8b -r 1a6336f2b3f9 tcp/httpdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tcp/httpdate.cpp Thu Nov 02 08:10:55 2017 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "time.h" +#include "http.h" +#include "clock.h" + +static void dateFromTm(struct tm* ptm, char* ptext) +{ + size_t size = strftime(ptext, HTTP_DATE_LENGTH, "%a, %d %b %Y %H:%M:%S GMT", ptm);//Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 +} +void HttpDateFromNow(char* pText) +{ + struct tm tm; + ClockTmUtc(&tm); + dateFromTm(&tm, pText); +} +void HttpDateFromDateTime(const char* date, const char *ptime, char* ptext) +{ + struct tm tm; + TimeAsciiDateTimeToTm(date, ptime, &tm); + dateFromTm(&tm, ptext); +}