#include "nsd.h"Functions | |
| char * | Ns_HttpTime (Ns_DString *pds, time_t *when) |
| time_t | Ns_ParseHttpTime (char *str) |
| int | NsTclParseHttpTimeObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
| int | NsTclHttpTimeObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
| char* Ns_HttpTime | ( | Ns_DString * | pds, | |
| time_t * | when | |||
| ) |
----------------------------------------------------------------------
Ns_Httptime --
Convert a time_t into a time/date format used in HTTP (see RFC 1123). If passed-in time is null, then the current time will be used.
Results: The string time, or NULL if error.
Side effects: None.
----------------------------------------------------------------------
This will most likely break if the locale is not an english one. The format is RFC 1123: "Sun, 06 Nov 1997 09:12:45 GMT"
| time_t Ns_ParseHttpTime | ( | char * | str | ) |
----------------------------------------------------------------------
Ns_ParseHttpTime --
Take a time in one of three formats and convert it to a time_t. Formats are: "Thursday, 10-Jun-93 01:29:59 GMT", "Thu, 10 Jan 1993 01:29:59 GMT", or "Wed Jun 9 01:29:59 1993 GMT"
Results: 0 if error, or standard time_t.
Side effects: None.
----------------------------------------------------------------------
Find the comma after day-of-week
Thursday, 10-Jun-93 01:29:59 GMT ^ +-- s
Thu, 10 Jan 1993 01:29:59 GMT ^ +-- s
Advance S to the first non-space after the comma which should be the first digit of the day.
Figure out which format it is in. If there is a hyphen, then it must be the first format.
The format is:
Thursday, 10-Jun-93 01:29:59 GMT ^ +--s
The format is:
Thu, 10 Jan 1993 01:29:59 GMT ^ +--s
No commas, so it must be the third, fixed field, format:
Wed Jun 9 01:29:59 1993 GMT
Advance s to the first letter of the month.
If there are any impossible values, then return an error.
| int NsTclHttpTimeObjCmd | ( | ClientData | arg, | |
| Tcl_Interp * | interp, | |||
| int | objc, | |||
| Tcl_Obj *CONST | objv[] | |||
| ) |
----------------------------------------------------------------------
NsTclHttpTimeObjCmd --
Implements ns_httptime as obj command.
Results: Tcl result.
Side effects: See docs.
----------------------------------------------------------------------
| int NsTclParseHttpTimeObjCmd | ( | ClientData | arg, | |
| Tcl_Interp * | interp, | |||
| int | objc, | |||
| Tcl_Obj *CONST | objv[] | |||
| ) |
----------------------------------------------------------------------
NsTclParseHttpTimeObjCmd --
Implements ns_parsehttptime as obj command.
Results: Tcl result.
Side effects: See docs.
----------------------------------------------------------------------
1.5.1