Node:General Time String Parsing, Previous:Low-Level Time String Parsing, Up:Parsing Date and Time
The Unix standard defines another function for parsing date strings. The interface is weird, but if the function happens to suit your application it is just fine. It is problematic to use this function in multi-threaded programs or libraries, since it returns a pointer to a static variable, and uses a global variable and global state (an environment variable).
| getdate_err | Variable | 
| This variable of type intcontains the error code of the last
unsuccessful call togetdate.  Defined values are:
 | 
| struct tm * getdate (const char *string) | Function | 
| The interface to getdateis the simplest possible for a function
to parse a string and return the value.  string is the input
string and the result is returned in a statically-allocated variable.The details about how the string is processed are hidden from the user. 
In fact, they can be outside the control of the program.  Which formats
are recognized is controlled by the file named by the environment
variable  The  Elements not initialized through the format string retain the values
present at the time of the  The formats recognized by  
 It should be noted that the format in the template file need not only
contain format elements.  The following is a list of possible format
strings (taken from the Unix standard):
 %m %A %B %d, %Y %H:%M:%S %A %B %m/%d/%y %I %p %d,%m,%Y %H:%M at %A the %dst of %B in %Y run job at %I %p,%B %dnd %A den %d. %B %Y %H.%M Uhr As you can see, the template list can contain very specific strings like
 
 The return value of the function is a pointer to a static variable of
type  The  Warning: The  | 
| int getdate_r (const char *string, struct tm *tp) | Function | 
| The getdate_rfunction is the reentrant counterpart ofgetdate.  It does not use the global variablegetdate_errto signal an error, but instead returns an error code.  The same error
codes as described in thegetdate_errdocumentation above are
used, with 0 meaning success.Moreover,  This function is not defined in the Unix standard. Nevertheless it is available on some other Unix systems as well. The warning against using  |