aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/localtime.h
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-01 21:28:19 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-01 21:28:19 +0000
commitdd8a0566baf7c852967fb272055fbaa43b8e3b07 (patch)
tree271c16392c83b0ac2ff0226f1fd1cb4554e1bae7 /include/asterisk/localtime.h
parentc8b64290b516220434ca6aa4996372f8155294f3 (diff)
Support setting locale per-mailbox (changes date/time languages for email, pager messages).
(closes issue #14333) Reported by: klaus3000 Patches: 20090515__issue14333.diff.txt uploaded by tilghman (license 14) app_voicemail.c-svn-trunk-rev211675-patch.txt uploaded by klaus3000 (license 65) Tested by: klaus3000 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266828 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/localtime.h')
-rw-r--r--include/asterisk/localtime.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/asterisk/localtime.h b/include/asterisk/localtime.h
index 8858c43a3..ed5fe36b9 100644
--- a/include/asterisk/localtime.h
+++ b/include/asterisk/localtime.h
@@ -1,10 +1,10 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2010, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
- * Tilghman Lesher <tlesher@vcch.com>
+ * Tilghman Lesher <tlesher AT digium DOT com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -24,6 +24,12 @@
#ifndef _ASTERISK_LOCALTIME_H
#define _ASTERISK_LOCALTIME_H
+#ifdef HAVE_NEWLOCALE
+#include <locale.h>
+#else
+typedef void * locale_t;
+#endif
+
struct ast_tm {
int tm_sec; /*!< Seconds. [0-60] (1 leap second) */
int tm_min; /*!< Minutes. [0-59] */
@@ -57,6 +63,9 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_
*/
struct timeval ast_mktime(struct ast_tm * const tmp, const char *zone);
+/*!\brief Set the thread-local representation of the current locale. */
+const char *ast_setlocale(const char *locale);
+
/*!\brief Special version of strftime(3) that handles fractions of a second.
* Takes the same arguments as strftime(3), with the addition of %q, which
* specifies microseconds.
@@ -64,9 +73,11 @@ struct timeval ast_mktime(struct ast_tm * const tmp, const char *zone);
* \param len Size of the chunk of memory buf.
* \param format A string specifying the format of time to be placed into buf.
* \param tm Pointer to the broken out time to be used for the format.
+ * \param locale Text string specifying the locale to be used for language strings.
* \retval An integer value specifying the number of bytes placed into buf or -1 on error.
*/
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm);
+int ast_strftime_locale(char *buf, size_t len, const char *format, const struct ast_tm *tm, const char *locale);
/*!\brief Special version of strptime(3) which places the answer in the common
* structure ast_tm. Also, unlike strptime(3), ast_strptime() initializes its
@@ -74,9 +85,11 @@ int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm
* \param s A string specifying some portion of a date and time.
* \param format The format in which the string, s, is expected.
* \param tm The broken-out time structure into which the parsed data is expected.
+ * \param locale Text string specifying the locale to be used for language strings.
* \retval A pointer to the first character within s not used to parse the date and time.
*/
char *ast_strptime(const char *s, const char *format, struct ast_tm *tm);
+char *ast_strptime_locale(const char *s, const char *format, struct ast_tm *tm, const char *locale);
/*!\brief Wakeup localtime monitor thread
* For use in testing. Normally, the failsafe monitor thread waits 60 seconds