RFC date and time conversion. More...
Go to the source code of this file.
Functions | |
char * | TimeParseYear (CONST char *str, int *year) |
Parse string containing the year. | |
char * | TimeParseMonth (CONST char *str, int *month) |
Parse a string for the name of a month. | |
char * | TimeParseDmy (CONST char *str, int *mday, int *mon, int *year) |
Parse date string. | |
char * | TimeParseHms (CONST char *str, int *hour, int *min, int *sec) |
Parse time of day string. | |
time_t | RfcTimeParse (CONST char *str) |
Parse RFC date and time string. | |
char * | Rfc1123TimeString (struct _tm *tm) |
Create RFC 1123 date and time string. |
RFC date and time conversion.
* * $Log$ * Revision 1.2 2009/01/04 21:06:53 olereinhardt * 2009-01-04 Ole Reinhardt <ole.reinhardt@thermotemp.de> * * * pro/rfctime.c: Fixed time parsing in RfcTimeParse * Thanks to Michael Fischer! * * Revision 1.1 2008/02/15 16:46:09 haraldkipp * First release. * * *
Definition in file rfctime.c.
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().
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* 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* 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().
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* 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().