[RFA] Add missing fields to struct lc_time_T

Jeff Johnston jjohnstn@redhat.com
Thu Feb 18 16:58:00 GMT 2010


Ok to check in, including Craig's additions.

-- Jeff J.

On 18/02/10 11:53 AM, Howland Craig D (Craig) wrote:
> Corinna:
> It would be nice if the comments being added to timelocal.h did what
> the existing ones do by including the structure member being
> initialized.
> Following is a suggestion enhancing your patch.  (I did check against
> POSIX, and added members look proper.)
> Craig
>
> Index: timelocal.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/locale/timelocal.c,v
> retrieving revision 1.3
> diff -p -u -r1.3 timelocal.c
> --- timelocal.c	9 Feb 2010 08:58:38 -0000	1.3
> +++ timelocal.c	18 Feb 2010 16:49:43 -0000
> @@ -92,7 +92,29 @@ static const struct lc_time_T	_C_time_lo
>   	/* ampm_fmt
>   	 * To determine 12-hour clock format time (empty, if N/A)
>   	 */
> -	"%I:%M:%S %p"
> +	"%I:%M:%S %p",
> +
> +	/* era
> +	 * This and the following entries are used if the alternative
> +	 * date format is specified in strftime
> +	 */
> +	"",
> +
> +	/* era_d_fmt
> +	 * Era date format used with the %Ex */
> +	"",
> +
> +	/* era_d_t_fmt
> +	 * Era date/time format (%Ec) */
> +	"",
> +
> +	/* era_t_fmt
> +	 * Era time format (%EX) */
> +	"",
> +
> +	/* alt_digits
> +	 * Alternate digits used if %O format prefix is specified */
> +	""
>   };
>
>   struct lc_time_T *
>
>
>
>
> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
> On Behalf Of Corinna Vinschen
> Sent: Thursday, February 18, 2010 11:14 AM
> To: newlib@sourceware.org
> Subject: [RFA] Add missing fields to struct lc_time_T
>
> Hi,
>
> the current struct lc_time_T in libc/locale/timelocal.h is missing the
> ERA related LC_TIME members required by POSIX-1.2008(*).  Only with
> these fields we can correctly implement the %E and %O format modifiers
> in the strftime and strptime functions at one point.
>
> The below patch adds these fields and the required changes to
> timeformat.c and nl_langinfo.c.
>
> Ok to apply?
>
>
> Thanks,
> Corinna
>
> (*)
> http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#t
> ag_07
>
>
> 	* libc/locale/timelocal.h (struct lc_time_T): Add missing
> ERA-related
> 	members.
> 	* libc/locale/timelocal.c (_C_time_local): Set new members to
> empty
> 	strings.
> ...
>
>   struct lc_time_T *__get_current_time_locale(void);
> Index: libc/locale/timelocal.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/locale/timelocal.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 timelocal.c
> --- libc/locale/timelocal.c	9 Feb 2010 08:58:38 -0000	1.3
> +++ libc/locale/timelocal.c	18 Feb 2010 16:05:12 -0000
> @@ -92,7 +92,24 @@ static const struct lc_time_T	_C_time_lo
>   	/* ampm_fmt
>   	 * To determine 12-hour clock format time (empty, if N/A)
>   	 */
> -	"%I:%M:%S %p"
> +	"%I:%M:%S %p",
> +
> +	/* Era.  This and the following entries are used if the
> alternative
> +	 * date format is specified in strftime
> +	 */
> +	"",
> +
> +	/* Era date format used with the %Ex */
> +	"",
> +
> +	/* Era date/time format (%Ec) */
> +	"",
> +
> +	/* Era time format (%EX) */
> +	"",
> +
> +	/* Alternate digits used if %O format prefix is specified */
> +	""
>   };
>
>   struct lc_time_T *
> ...



More information about the Newlib mailing list