1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2026-05-06 11:05:41 +00:00

Add strftime_l to the library. Only the C locale is supported.

* Makefile, NEWS: Document this.
* private.h (HAVE_STRFTIME_L): New macro.
* strftime.c (strftime_l) [HAVE_STRFTIME_L]: New function.
This commit is contained in:
Paul Eggert
2014-08-24 17:05:48 -07:00
parent 0e1d8b9d99
commit 9f7d50ae1c
4 changed files with 25 additions and 0 deletions

View File

@@ -115,6 +115,8 @@ LDLIBS=
# -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
# -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
# -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
# -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
# This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
# -DHAVE_SYMLINK=0 if your system lacks the symlink function
# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"

5
NEWS
View File

@@ -67,6 +67,11 @@ Unreleased, experimental changes
more likely to guess right for ambiguous time stamps near
transitions where tm_isdst does not change.
If HAVE_STRFTIME_L is defined to 1, the tz library now defines
strftime_l for compatibility with recent versions of POSIX.
Only the C locale is supported, though. HAVE_STRFTIME_L defaults
to 1 on recent POSIX versions, and to 0 otherwise.
zdump now builds with the tz library unless USE_LTZ is defined to 0,
This lets zdump use tz features even if the system library lacks them.
To build zdump with the system library, use 'make CFLAGS=-DUSE_LTZ=0

View File

@@ -101,6 +101,14 @@
#include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
#endif /* HAVE_UNISTD_H */
#ifndef HAVE_STRFTIME_L
# if _POSIX_VERSION < 200809
# define HAVE_STRFTIME_L 0
# else
# define HAVE_STRFTIME_L 1
# endif
#endif
#ifndef F_OK
#define F_OK 0
#endif /* !defined F_OK */

View File

@@ -106,6 +106,16 @@ extern char * tzname[];
#define IN_THIS 2
#define IN_ALL 3
#if HAVE_STRFTIME_L
size_t
strftime_l(char *s, size_t maxsize, char const *format, struct tm const *t,
locale_t locale)
{
/* Just call strftime, as only the C locale is supported. */
return strftime(s, maxsize, format, t);
}
#endif
size_t
strftime(char * const s, const size_t maxsize, const char *const format,
const struct tm *const t)