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

Committer:
andrewboyson
Date:
2018-01-11
Revision:
61:aad055f1b0d1
Parent:
tcp/http/httpdate.cpp@ 54:84ef2b29cf7e
Child:
92:b4542163f08d

File content as of revision 61:aad055f1b0d1:

#include <stdlib.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);
}