RFC date and time conversion header. More...
#include <time.h>
Go to the source code of this file.
Functions | |
char * | Rfc1123TimeString (struct _tm *tm) |
Create RFC 1123 date and time string. | |
time_t | RfcTimeParse (CONST char *str) |
Parse RFC date and time string. | |
char * | TimeParseHms (CONST char *str, int *hour, int *min, int *sec) |
Parse time of day string. | |
char * | TimeParseDmy (CONST char *str, int *mday, int *mon, int *year) |
Parse date string. | |
char * | TimeParseMonth (CONST char *str, int *month) |
Parse a string for the name of a month. | |
char * | TimeParseYear (CONST char *str, int *year) |
Parse string containing the year. |
RFC date and time conversion header.
* * $Log$ * Revision 1.1 2008/01/31 09:29:05 haraldkipp * RFC date and time conversion added. * * *
Definition in file rfctime.h.
char* Rfc1123TimeString | ( | struct _tm * | tm | ) |
Create RFC 1123 date and time string.
tm | Pointer to the date and time structure. |
Definition at line 309 of file rfctime.c.
References sprintf, _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, _tm::tm_wday, and _tm::tm_year.
Referenced by NutHttpSendHeaderTop(), and NutSmtpSendMailHeader().
time_t RfcTimeParse | ( | CONST char * | str | ) |
Parse RFC date and time string.
This routine accepts RFC 850, RFC 1123 and asctime time formats.
str | Pointer to the date and time string. |
Definition at line 264 of file rfctime.c.
References _mkgmtime(), mktime(), strcmp(), TimeParseDmy(), TimeParseHms(), TimeParseMonth(), TimeParseYear(), _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, and _tm::tm_year.
Referenced by main().
char* TimeParseHms | ( | CONST char * | str, |
int * | hour, | ||
int * | min, | ||
int * | sec | ||
) |
Parse time of day string.
Parses a string of the format hour ':' minute ':' second.
str | Pointer to the time string. |
hour | Points to the variable that will receive the hour (0..23). |
min | Points to the variable that will receive the minute (0..59). |
sec | Points to the variable that will receive the second (0..59). |
Definition at line 237 of file rfctime.c.
Referenced by RfcTimeParse().
char* TimeParseDmy | ( | CONST char * | str, |
int * | mday, | ||
int * | mon, | ||
int * | year | ||
) |
Parse date string.
Parses a string of the format day 'x' month-name 'x' year, where 'x' is any non-alphanumeric character.
str | Pointer to the date string. |
mday | Points to the variable that will receive the day (1..31). |
mon | Points to the variable that will receive the month (0..11). |
year | Points to the variable that will receive the years since 1900. |
Definition at line 210 of file rfctime.c.
References TimeParseMonth(), and TimeParseYear().
Referenced by RfcTimeParse().
char* TimeParseMonth | ( | CONST char * | str, |
int * | month | ||
) |
Parse a string for the name of a month.
Does basic comparision only, no range checking etc. For example, if the string starts with capital letter 'D', December is assumed without further checking the rest. It will work for abbreviated as well as full names.
str | Pointer to the time string. Must start with a capital letter followed by lower case characters. |
month | Points to the variable that will receive the month (0..11). |
Definition at line 135 of file rfctime.c.
Referenced by RfcTimeParse(), and TimeParseDmy().
char* TimeParseYear | ( | CONST char * | str, |
int * | year | ||
) |
Parse string containing the year.
Works with years including and excluding the century. If the resulting value is lower than 70, the 21st century is assumed. Values
str | Pointer to the time string. |
year | Points to the variable that will receive the years since 1900. |
Definition at line 109 of file rfctime.c.
Referenced by RfcTimeParse(), and TimeParseDmy().