]>
git.saurik.com Git - apple/libc.git/blob - stdtime/FreeBSD/timelocal.c
87312f438f61a053a90786d5908c11e6788cfce9
2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
3 * Copyright (c) 1997 FreeBSD Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include <sys/cdefs.h>
29 __FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.24 2002/08/07 16:49:20 ache Exp $");
34 #include "timelocal.h"
36 static struct lc_time_T _time_locale
;
37 static int _time_using_locale
;
38 static char *time_locale_buf
;
40 #define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
42 static const struct lc_time_T _C_time_locale
= {
44 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
45 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
47 "January", "February", "March", "April", "May", "June",
48 "July", "August", "September", "October", "November", "December"
50 "Sun", "Mon", "Tue", "Wed",
53 "Sunday", "Monday", "Tuesday", "Wednesday",
54 "Thursday", "Friday", "Saturday"
62 * Since the C language standard calls for
63 * "date, using locale's date format," anything goes.
64 * Using just numbers (as here) makes Quakers happier;
65 * it's also compatible with SVR4.
72 "%a %b %e %H:%M:%S %Y",
81 "%a %b %e %H:%M:%S %Z %Y",
84 * Standalone months forms for %OB
87 "January", "February", "March", "April", "May", "June",
88 "July", "August", "September", "October", "November", "December"
92 * Month / day order in dates
97 * To determine 12-hour clock format time (empty, if N/A)
103 __get_current_time_locale(void)
105 return (_time_using_locale
107 : (struct lc_time_T
*)&_C_time_locale
);
111 __time_load_locale(const char *name
)
113 return (__part_load_locale(name
, &_time_using_locale
,
114 time_locale_buf
, "LC_TIME",
115 LCTIME_SIZE
, LCTIME_SIZE
,
116 (const char **)&_time_locale
));