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
tcp/http/httpdate.c@125:8c84daac38ab, 2019-02-22 (annotated)
- Committer:
- andrewboyson
- Date:
- Fri Feb 22 11:26:55 2019 +0000
- Revision:
- 125:8c84daac38ab
- Parent:
- 100:ca674129aa0a
tidied up ntp data types for calculating ms from clktime.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 61:aad055f1b0d1 | 1 | #include <stdlib.h> |
andrewboyson | 61:aad055f1b0d1 | 2 | |
andrewboyson | 100:ca674129aa0a | 3 | #include "tm.h" |
andrewboyson | 100:ca674129aa0a | 4 | #include "http.h" |
andrewboyson | 100:ca674129aa0a | 5 | #include "clk.h" |
andrewboyson | 4:31fa7d50722c | 6 | |
andrewboyson | 21:02c82594c8c0 | 7 | static void dateFromTm(struct tm* ptm, char* ptext) |
andrewboyson | 2:849103b5a16d | 8 | { |
andrewboyson | 2:849103b5a16d | 9 | 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 | 10 | } |
andrewboyson | 21:02c82594c8c0 | 11 | void HttpDateFromNow(char* pText) |
andrewboyson | 2:849103b5a16d | 12 | { |
andrewboyson | 2:849103b5a16d | 13 | struct tm tm; |
andrewboyson | 100:ca674129aa0a | 14 | ClkNowTmUtc(&tm); |
andrewboyson | 21:02c82594c8c0 | 15 | dateFromTm(&tm, pText); |
andrewboyson | 2:849103b5a16d | 16 | } |
andrewboyson | 21:02c82594c8c0 | 17 | void HttpDateFromDateTime(const char* date, const char *ptime, char* ptext) |
andrewboyson | 2:849103b5a16d | 18 | { |
andrewboyson | 2:849103b5a16d | 19 | struct tm tm; |
andrewboyson | 92:b4542163f08d | 20 | TmFromAsciiDateTime(date, ptime, &tm); |
andrewboyson | 21:02c82594c8c0 | 21 | dateFromTm(&tm, ptext); |
andrewboyson | 3:ab6fd66d172c | 22 | } |