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@61:aad055f1b0d1, 2018-01-11 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Jan 11 17:38:21 2018 +0000
- Revision:
- 61:aad055f1b0d1
- Parent:
- tcp/http/httpdate.cpp@54:84ef2b29cf7e
- Child:
- 92:b4542163f08d
Removed dependence on Mbed OS
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 | 22:914b970356f0 | 3 | #include "time.h" |
andrewboyson | 22:914b970356f0 | 4 | #include "http.h" |
andrewboyson | 22:914b970356f0 | 5 | #include "clock.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 | 22:914b970356f0 | 14 | ClockTmUtc(&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 | 2:849103b5a16d | 20 | TimeAsciiDateTimeToTm(date, ptime, &tm); |
andrewboyson | 21:02c82594c8c0 | 21 | dateFromTm(&tm, ptext); |
andrewboyson | 3:ab6fd66d172c | 22 | } |