1 /* 2 * gnc-date-p.h 3 * 4 * Copyright (C) 2007 Andreas Koehler <andi5.py@gmx.net> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, contact: 18 * 19 * Free Software Foundation Voice: +1-617-542-5942 20 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 21 * Boston, MA 02110-1301, USA gnu@gnu.org 22 */ 23 24 #ifndef __GNC_DATE_P_H__ 25 #define __GNC_DATE_P_H__ 26 #ifdef __cplusplus 27 extern "C" 28 { 29 #endif 30 31 #include <stdint.h> 32 #include "gnc-date.h" 33 34 /** Convert a given date/time format from UTF-8 to an encoding suitable for the 35 * strftime system call. 36 * 37 * @param utf8_format Date/time format specification in UTF-8. 38 * 39 * @return A newly allocated string on success, or NULL otherwise. 40 */ 41 gchar *qof_time_format_from_utf8(const gchar *utf8_format); 42 43 /** Convert a result of a call to strftime back to UTF-8. 44 * 45 * @param locale_string The result of a call to strftime. 46 * 47 * @return A newly allocated string on success, or NULL otherwise. 48 */ 49 gchar *qof_formatted_time_to_utf8(const gchar *locale_string); 50 51 52 #ifdef G_OS_WIN32 53 54 typedef enum 55 { 56 QOF_WIN32_PICTURE_DATE, 57 QOF_WIN32_PICTURE_TIME, 58 QOF_WIN32_PICTURE_DATETIME 59 } QofWin32Picture; 60 61 /** Get a strftime/strptime format specification for date, time or date and time, 62 * according to the pictures for LOCALE_SSHORTDATE, LOCALE_STIMEFORMAT or a 63 * combination of both with a space in between, respectively. 64 * 65 * @param picture The type of spec requested. Date, time or both. 66 * 67 * @return The format specification as constant ASCII string. 68 */ 69 const char *qof_win32_get_time_format(QofWin32Picture picture); 70 #endif /* G_OS_WIN32 */ 71 72 /* Test Access for static functions */ 73 typedef struct 74 { 75 GTimeZone* (*timezone_new_local) (void); 76 } Testfuncs; 77 78 Testfuncs *gnc_date_load_funcs (void); 79 80 #ifdef __cplusplus 81 } 82 #endif 83 #endif /* __GNC_DATE_P_H__ */ 84