Parsing functions for RFC 1123 (GMT) date.
#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <sofia-sip/msg_date.h>
#include <sofia-sip/bnf.h>
#include <sofia-sip/su_time.h>
Include dependency graph for msg_date.c:
Defines | |
#define | EPOCH |
Epoch year. | |
#define | LEAP_YEAR(y) |
Is this year a leap year? | |
#define | YEAR_DAYS(y) |
Day number of New Year Day of given year. | |
Functions | |
msg_time_t | msg_now (void) |
Return current time as seconds since Mon, 01 Jan 1900 00:00:00 GMT. | |
int | msg_date_d (char const **ss, msg_time_t *date) |
Decode RFC1123-date, RFC822-date or asctime-date. | |
int | msg_date_e (char b[], int bsiz, msg_time_t http_date) |
Encode RFC1123-date. | |
int | msg_delta_d (char const **ss, msg_time_t *delta) |
Decode a http-delta. | |
int | msg_delta_e (char b[], int bsiz, msg_time_t delta) |
Encode http-delta. | |
int | msg_date_delta_d (char const **ss, msg_time_t *date, msg_time_t *delta) |
Decode a date or delta. |
#define EPOCH |
Epoch year.
First day of the epoch year should be Monday.
int msg_date_d | ( | char const ** | ss, | |
msg_time_t * | date | |||
) |
Decode RFC1123-date, RFC822-date or asctime-date.
The function msg_date_d() decodes HTTP-date, which may have different formats.
* HTTP-date = rfc1123-date | rfc850-date | asctime-date * rfc1123-date = wkday "," SP date1 SP time SP "GMT" * rfc850-date = weekday "," SP date2 SP time SP "GMT" * asctime-date = wkday SP date3 SP time SP 4DIGIT * date1 = 2DIGIT SP month SP 4DIGIT * ; day month year (e.g., 02 Jun 1982) * date2 = 2DIGIT "-" month "-" 2DIGIT * ; day-month-year (e.g., 02-Jun-82) * date3 = month SP ( 2DIGIT | ( SP 1DIGIT )) * ; month day (e.g., Jun 2) * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT * ; 00:00:00 - 23:59:59 * wkday = "Mon" | "Tue" | "Wed" * | "Thu" | "Fri" | "Sat" | "Sun" * weekday = "Monday" | "Tuesday" | "Wednesday" * | "Thursday" | "Friday" | "Saturday" | "Sunday" * month = "Jan" | "Feb" | "Mar" | "Apr" * | "May" | "Jun" | "Jul" | "Aug" * | "Sep" | "Oct" | "Nov" | "Dec" *
int msg_date_delta_d | ( | char const ** | ss, | |
msg_time_t * | date, | |||
msg_time_t * | delta | |||
) |
Decode a date or delta.
The function msg_date_delta_d() decodes a http-date or http-delta field.
int msg_date_e | ( | char | b[], | |
int | bsiz, | |||
msg_time_t | http_date | |||
) |
Encode RFC1123-date.
The function msg_date_e() prints http-date in the rfc1123-date format. The format is as follows:
* rfc1123-date = wkday "," SP date SP time SP "GMT" * wkday = "Mon" | "Tue" | "Wed" * | "Thu" | "Fri" | "Sat" | "Sun" * date = 2DIGIT SP month SP 4DIGIT * ; day month year (e.g., 02 Jun 1982) * month = "Jan" | "Feb" | "Mar" | "Apr" * | "May" | "Jun" | "Jul" | "Aug" * | "Sep" | "Oct" | "Nov" | "Dec" * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT * ; 00:00:00 - 23:59:59 *
b | buffer to print the date | |
bsiz | size of the buffer | |
http_date | seconds since 01 Jan 1900. |
int msg_delta_d | ( | char const ** | ss, | |
msg_time_t * | delta | |||
) |
Decode a http-delta.
The function msg_delta_d() decodes a http-delta field.