/* Year */
if (tm.tm_year > 99) {
res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
+ } else if (tm.tm_year < 1) {
+ /* I'm not going to handle 1900 and prior */
+ /* We'll just be silent on the year, instead of bombing out. */
} else {
- if (tm.tm_year < 1) {
- /* I'm not going to handle 1900 and prior */
- /* We'll just be silent on the year, instead of bombing out. */
- } else {
- res = wait_file(chan,ints, "digits/19",lang);
- if (!res) {
- if (tm.tm_year <= 9) {
- /* 1901 - 1909 */
- res = wait_file(chan,ints, "digits/oh",lang);
- if (!res) {
- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);
- res = wait_file(chan,ints,nextmsg,lang);
- }
- } else if (tm.tm_year <= 20) {
- /* 1910 - 1920 */
- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);
- res = wait_file(chan,ints,nextmsg,lang);
- } else {
- /* 1921 - 1999 */
- int ten, one;
- ten = tm.tm_year / 10;
- one = tm.tm_year % 10;
- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten * 10);
- res = wait_file(chan,ints,nextmsg,lang);
- if (!res) {
- if (one != 0) {
- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);
- res = wait_file(chan,ints,nextmsg,lang);
- }
- }
- }
+ res = wait_file(chan, ints, "digits/19", lang);
+ if (!res) {
+ if (tm.tm_year <= 9) {
+ /* 1901 - 1909 */
+ res = wait_file(chan,ints, "digits/oh", lang);
}
+
+ res |= ast_say_number(chan, tm.tm_year, ints, lang, (char *) NULL);
}
}
break;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
} else if (beg_today - 86400 < time) {
/* Yesterday */
res = wait_file(chan,ints, "digits/yesterday",lang);
+ } else if (beg_today - 86400 * 6 < time) {
+ /* Within the last week */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "A", timezone);
+ } else if (beg_today - 2628000 < time) {
+ /* Less than a month ago - "Sunday, October third" */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "ABd", timezone);
+ } else if (beg_today - 15768000 < time) {
+ /* Less than 6 months ago - "August seventh" */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "Bd", timezone);
} else {
- res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);
+ /* More than 6 months ago - "April nineteenth two thousand three" */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "BdY", timezone);
}
}
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
res = wait_file(chan,ints, "digits/yesterday",lang);
} else if (beg_today - 86400 * 6 < time) {
/* Within the last week */
- res = ast_say_date_with_format(chan, time, ints, lang, "A", timezone);
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "A", timezone);
+ } else if (beg_today - 2628000 < time) {
+ /* Less than a month ago - "Sunday, October third" */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "ABd", timezone);
+ } else if (beg_today - 15768000 < time) {
+ /* Less than 6 months ago - "August seventh" */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "Bd", timezone);
} else {
- res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);
+ /* More than 6 months ago - "April nineteenth two thousand three" */
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "BdY", timezone);
}
}
break;
case 'R':
- res = ast_say_date_with_format(chan, time, ints, lang, "HM", timezone);
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "HM", timezone);
break;
case 'S':
/* Seconds */
}
break;
case 'T':
- res = ast_say_date_with_format(chan, time, ints, lang, "HMS", timezone);
+ res = ast_say_date_with_format_en(chan, time, ints, lang, "HMS", timezone);
break;
case ' ':
case ' ':
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or AdBY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or AdBY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
case 'q':
/* Shorthand for "" (today), "Yesterday", A
* (weekday), or "date" */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or AdBY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or AdBY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'Q':
/* Shorthand for "Today", "Yesterday", or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;
break;
case 'q':
/* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */
+ /* XXX As emphasized elsewhere, this should the native way in your
+ * language to say the date, with changes in what you say, depending
+ * upon how recent the date is. XXX */
{
struct timeval now;
struct tm tmnow;