Nut/OS  4.10.3
API Reference
rfctime.h File Reference

RFC date and time conversion header. More...

#include <time.h>
Include dependency graph for rfctime.h:
This graph shows which files directly or indirectly include this file:

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.

Detailed Description

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.


Function Documentation

char* Rfc1123TimeString ( struct _tm tm)

Create RFC 1123 date and time string.

Parameters:
tmPointer to the date and time structure.
Returns:
Pointer to a static buffer containing the string.
Examples:
pppc/pppc.c.

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.

Parameters:
strPointer to the date and time string.
Returns:
Number of seconds since epoch or -1 in case of any error.
Examples:
caltime/caltime.c.

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().

Here is the call graph for this function:

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.

Parameters:
strPointer to the time string.
hourPoints to the variable that will receive the hour (0..23).
minPoints to the variable that will receive the minute (0..59).
secPoints to the variable that will receive the second (0..59).
Returns:
Pointer into the string after the parsed characters.

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.

Parameters:
strPointer to the date string.
mdayPoints to the variable that will receive the day (1..31).
monPoints to the variable that will receive the month (0..11).
yearPoints to the variable that will receive the years since 1900.
Returns:
Pointer into the string after the parsed characters.

Definition at line 210 of file rfctime.c.

References TimeParseMonth(), and TimeParseYear().

Referenced by RfcTimeParse().

Here is the call graph for this function:

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.

Parameters:
strPointer to the time string. Must start with a capital letter followed by lower case characters.
monthPoints to the variable that will receive the month (0..11).
Returns:
Pointer into the string after the parsed characters.

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

Parameters:
strPointer to the time string.
yearPoints to the variable that will receive the years since 1900.
Returns:
Pointer into the string after the parsed characters.

Definition at line 109 of file rfctime.c.

Referenced by RfcTimeParse(), and TimeParseDmy().