Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Contains the source for LC_TIME category related functions
21 #include "localeinfo.h"
22 #include "timelocal.h"
24 #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
25 #include "libc_wsd_defs.h"
28 extern int __nlocale_changed;
30 int *GET_WSD_VAR_NAME(__nlocale_changed, g)();
31 #define __nlocale_changed (*GET_WSD_VAR_NAME(__nlocale_changed, g)())
34 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
35 extern unsigned char __clocale_set;
37 unsigned char *GET_WSD_VAR_NAME(__clocale_set, g)();
38 #define __clocale_set (*GET_WSD_VAR_NAME(__clocale_set, g)())
42 int _time_using_locale = 0;
45 GET_GLOBAL_VAR_FROM_TLS(_time_using_locale, int)
46 #define _time_using_locale (*GET_WSD_VAR_NAME(_time_using_locale, g)())
49 static const struct lc_time_T _C_time_locale = {
51 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
52 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
54 "January", "February", "March", "April", "May", "June",
55 "July", "August", "September", "October", "November", "December"
57 "Sun", "Mon", "Tue", "Wed",
60 "Sunday", "Monday", "Tuesday", "Wednesday",
61 "Thursday", "Friday", "Saturday"
69 * Since the C language standard calls for
70 * "date, using locale's date format," anything goes.
71 * Using just numbers (as here) makes Quakers happier;
72 * it's also compatible with SVR4.
79 "%a %b %e %H:%M:%S %Y",
88 "%a %b %e %H:%M:%S %Z %Y",
91 * Standalone months forms for %OB
94 "January", "February", "March", "April", "May", "June",
95 "July", "August", "September", "October", "November", "December"
99 * Month / day order in dates
104 * To determine 12-hour clock format time (empty, if N/A)
110 __get_current_time_locale(void)
112 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
115 //retrieve time(LC_TIME category) related information
116 if(_time_using_locale)
118 return (CLocale::GetCurrentTimeLocale());
120 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
121 else if(__clocale_set)
123 //Retrieve POSIX locale time(LC_TIME) information
124 return (struct lc_time_T *)&_C_time_locale;
125 #ifdef SYMBIAN_OE_ENHANCED_LOCALE_SUPPORT
128 CLocale *l=CLocale::GetInstance();
129 ret=l->SyncLocale(ELocaleLanguageSettings);
132 TRAPD(result, l->TimeLoadLocaleL(NULL));
133 if((result != KErrNone))
135 return (CLocale::GetCurrentTimeLocale());
141 __time_load_locale(const char* localeName)
144 CLocale* locale = CLocale::GetInstance();
145 //Set time(LC_TIME category) related information
147 TRAPD(result,ret = locale->TimeLoadLocaleL(localeName));
148 if((result != KErrNone) || (ret == -1))
152 _time_using_locale = 1;