Summary:ASTERISK-06102: Added STRPTIME to func_strings.c to complement STRFTIME
Reporter:Beau Hargis (beaufrog)Labels:
Date Opened:2006-01-16 20:03:10.000-0600Date Closed:2006-01-22 01:09:45.000-0600
Versions:Frequency of
Environment:Attachments:( 0) strptime-1.2.x.patch
Description:Needed a way to use SayUnixTime with an arbritrary date in an IVR app. Needed a way to convert any arbitrary date to an epoch for that to work. Doesnt seem to be any other way to get SayUnixTime to do anything but say the current date, unless one just happens to store the epoch for every date value stored.


The attached patch is against the current 1.2 branch. I can make one for CVS head if needed. Generates a warning about ununsed *timezone variable, but works. Will fix that, but wanted to get some input on it first.
Comments:By: Tilghman Lesher (tilghman) 2006-01-16 20:34:48.000-0600

Formatting of this patch is inconsistent.  We use tab-based indentation, not a combination of spacing and tabs.  Please see the CODING-GUIDELINES in the doc directory.

Instead of using strsep(), you need to use the macros for argument parsing.  Please see other functions in trunk for examples.

As this is a new feature, it is not eligible for inclusion in 1.2, but may be considered for trunk.

Your struct ast_custom_function should specify a description (.desc), in which you should better describe the functionality, including an example of its usage.

You may be interested in ast_mktime(), since that function permits the specification of a timezone separate from struct tm.  The prototype for ast_mktime() may be found in include/asterisk/localtime.h.

By: Tilghman Lesher (tilghman) 2006-01-22 01:09:33.000-0600

Committed to trunk, with changes.