OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [locale/] [timelocal.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/*-
/*-
 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
 * Copyright (c) 1997 FreeBSD Inc.
 * Copyright (c) 1997 FreeBSD Inc.
 * All rights reserved.
 * All rights reserved.
 *
 *
 * Redistribution and use in source and binary forms, with or without
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * modification, are permitted provided that the following conditions
 * are met:
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *    documentation and/or other materials provided with the distribution.
 *
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * SUCH DAMAGE.
 */
 */
 
 
#include <sys/cdefs.h>
#include <sys/cdefs.h>
 
 
#include <stddef.h>
#include <stddef.h>
 
 
#include "ldpart.h"
#include "ldpart.h"
#include "timelocal.h"
#include "timelocal.h"
 
 
static struct lc_time_T _time_locale;
static struct lc_time_T _time_locale;
static int _time_using_locale;
static int _time_using_locale;
static char *time_locale_buf;
static char *time_locale_buf;
 
 
#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
 
 
static const struct lc_time_T   _C_time_locale = {
static const struct lc_time_T   _C_time_locale = {
        {
        {
                "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
        }, {
        }, {
                "January", "February", "March", "April", "May", "June",
                "January", "February", "March", "April", "May", "June",
                "July", "August", "September", "October", "November", "December"
                "July", "August", "September", "October", "November", "December"
        }, {
        }, {
                "Sun", "Mon", "Tue", "Wed",
                "Sun", "Mon", "Tue", "Wed",
                "Thu", "Fri", "Sat"
                "Thu", "Fri", "Sat"
        }, {
        }, {
                "Sunday", "Monday", "Tuesday", "Wednesday",
                "Sunday", "Monday", "Tuesday", "Wednesday",
                "Thursday", "Friday", "Saturday"
                "Thursday", "Friday", "Saturday"
        },
        },
 
 
        /* X_fmt */
        /* X_fmt */
        "%H:%M:%S",
        "%H:%M:%S",
 
 
        /*
        /*
         * x_fmt
         * x_fmt
         * Since the C language standard calls for
         * Since the C language standard calls for
         * "date, using locale's date format," anything goes.
         * "date, using locale's date format," anything goes.
         * Using just numbers (as here) makes Quakers happier;
         * Using just numbers (as here) makes Quakers happier;
         * it's also compatible with SVR4.
         * it's also compatible with SVR4.
         */
         */
        "%m/%d/%y",
        "%m/%d/%y",
 
 
        /*
        /*
         * c_fmt
         * c_fmt
         */
         */
        "%a %b %e %H:%M:%S %Y",
        "%a %b %e %H:%M:%S %Y",
 
 
        /* am */
        /* am */
        "AM",
        "AM",
 
 
        /* pm */
        /* pm */
        "PM",
        "PM",
 
 
        /* date_fmt */
        /* date_fmt */
        "%a %b %e %H:%M:%S %Z %Y",
        "%a %b %e %H:%M:%S %Z %Y",
 
 
        /* alt_month
        /* alt_month
         * Standalone months forms for %OB
         * Standalone months forms for %OB
         */
         */
        {
        {
                "January", "February", "March", "April", "May", "June",
                "January", "February", "March", "April", "May", "June",
                "July", "August", "September", "October", "November", "December"
                "July", "August", "September", "October", "November", "December"
        },
        },
 
 
        /* md_order
        /* md_order
         * Month / day order in dates
         * Month / day order in dates
         */
         */
        "md",
        "md",
 
 
        /* ampm_fmt
        /* ampm_fmt
         * To determine 12-hour clock format time (empty, if N/A)
         * To determine 12-hour clock format time (empty, if N/A)
         */
         */
        "%I:%M:%S %p"
        "%I:%M:%S %p"
};
};
 
 
struct lc_time_T *
struct lc_time_T *
__get_current_time_locale(void) {
__get_current_time_locale(void) {
        return (_time_using_locale
        return (_time_using_locale
                ? &_time_locale
                ? &_time_locale
                : (struct lc_time_T *)&_C_time_locale);
                : (struct lc_time_T *)&_C_time_locale);
}
}
 
 
int
int
__time_load_locale(const char *name) {
__time_load_locale(const char *name) {
 
 
        int     ret;
        int     ret;
 
 
        ret = __part_load_locale(name, &_time_using_locale,
        ret = __part_load_locale(name, &_time_using_locale,
                        time_locale_buf, "LC_TIME",
                        time_locale_buf, "LC_TIME",
                        LCTIME_SIZE, LCTIME_SIZE,
                        LCTIME_SIZE, LCTIME_SIZE,
                        (const char **)&_time_locale);
                        (const char **)&_time_locale);
 
 
        return (ret);
        return (ret);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.