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

Committer:
andrewboyson
Date:
Mon Jul 03 14:29:07 2017 +0000
Revision:
22:914b970356f0
Parent:
21:02c82594c8c0
Corrected NTP client function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 22:914b970356f0 1 #include "mbed.h"
andrewboyson 22:914b970356f0 2 #include "time.h"
andrewboyson 22:914b970356f0 3 #include "http.h"
andrewboyson 22:914b970356f0 4 #include "clock.h"
andrewboyson 4:31fa7d50722c 5
andrewboyson 21:02c82594c8c0 6 static void dateFromTm(struct tm* ptm, char* ptext)
andrewboyson 2:849103b5a16d 7 {
andrewboyson 2:849103b5a16d 8 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
andrewboyson 2:849103b5a16d 9 }
andrewboyson 21:02c82594c8c0 10 void HttpDateFromNow(char* pText)
andrewboyson 2:849103b5a16d 11 {
andrewboyson 2:849103b5a16d 12 struct tm tm;
andrewboyson 22:914b970356f0 13 ClockTmUtc(&tm);
andrewboyson 21:02c82594c8c0 14 dateFromTm(&tm, pText);
andrewboyson 2:849103b5a16d 15 }
andrewboyson 21:02c82594c8c0 16 void HttpDateFromDateTime(const char* date, const char *ptime, char* ptext)
andrewboyson 2:849103b5a16d 17 {
andrewboyson 2:849103b5a16d 18 struct tm tm;
andrewboyson 2:849103b5a16d 19 TimeAsciiDateTimeToTm(date, ptime, &tm);
andrewboyson 21:02c82594c8c0 20 dateFromTm(&tm, ptext);
andrewboyson 3:ab6fd66d172c 21 }