msg 1.12.11devel
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
msg_date.h File Reference

Types and functions for handling dates and times. More...

#include <sofia-sip/su_types.h>
Include dependency graph for msg_date.h:

Go to the source code of this file.

Macros

#define MSG_DATE_H
 Defined when <sofia-sip/msg_date.h> has been included.
 
#define MSG_TIME_MAX
 Latest time that can be expressed with msg_time_t.
 

Typedefs

typedef unsigned long msg_time_t
 Time in seconds since epoch (1900-Jan-01 00:00:00).
 

Functions

msg_time_t msg_now (void)
 Return current time as seconds since Mon, 01 Jan 1900 00:00:00 GMT.
 
issize_t msg_date_delta_d (char const **inout_string, msg_time_t *return_date, msg_time_t *return_delta)
 Decode a HTTP date or delta.
 
issize_t msg_delta_d (char const **ss, msg_time_t *return_delta)
 Decode a delta-seconds.
 
issize_t msg_delta_e (char b[], isize_t bsiz, msg_time_t delta)
 Encode <delta-seconds> field.
 
issize_t msg_date_d (char const **ss, msg_time_t *date)
 Decode RFC1123-date, RFC822-date or asctime-date.
 
issize_t msg_date_e (char b[], isize_t bsiz, msg_time_t date)
 Encode RFC1123-date.
 

Detailed Description

Types and functions for handling dates and times.

Author
Pekka Pessi Pekka.nosp@m..Pes.nosp@m.si@no.nosp@m.kia..nosp@m.com
Date
Created: Thu Jun 8 19:28:55 2000 ppessi

Function Documentation

◆ msg_date_d()

issize_t 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"
date1 = 2DIGIT SP month SP 4DIGIT
; day month year (e.g., 02 Jun 1982)
rfc850-date = weekday "," SP date2 SP time SP "GMT"
date2 = 2DIGIT "-" month "-" 2DIGIT
; day-month-year (e.g., 02-Jun-82)
asctime-date = wkday SP date3 SP time SP 4DIGIT
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"

◆ msg_date_delta_d()

issize_t msg_date_delta_d ( char const **  ss,
msg_time_t date,
msg_time_t delta 
)

Decode a HTTP date or delta.

Decode a <http-date> or <delta-seconds> field.

◆ msg_date_e()

issize_t msg_date_e ( char  b[],
isize_t  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
Parameters
bbuffer to print the date
bsizsize of the buffer
http_dateseconds since 01 Jan 1900.
Returns
The function msg_date_e() returns the size of the formatted date.

◆ msg_delta_d()

issize_t msg_delta_d ( char const **  ss,
msg_time_t delta 
)

Decode a delta-seconds.

The function msg_delta_d() decodes a <delta-seconds> field.

The <delta-seconds> is defined as follows:

delta-seconds = 1*DIGIT

Note, however, that <delta-seconds> may not be larger than MSG_TIME_MAX.


Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.