2011-01-30 23:34:18 +00:00
|
|
|
/* declarations for strftime.c
|
|
|
|
|
2024-01-02 01:47:10 +00:00
|
|
|
Copyright (C) 2002, 2004, 2008-2024 Free Software Foundation, Inc.
|
2011-01-30 23:34:18 +00:00
|
|
|
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
This file is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as
|
2022-02-23 19:11:52 +00:00
|
|
|
published by the Free Software Foundation, either version 3 of the
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
License, or (at your option) any later version.
|
2011-01-30 23:34:18 +00:00
|
|
|
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
This file is distributed in the hope that it will be useful,
|
2011-01-30 23:34:18 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
GNU Lesser General Public License for more details.
|
2011-01-30 23:34:18 +00:00
|
|
|
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2017-09-13 09:07:03 +00:00
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
2011-01-30 23:34:18 +00:00
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2024-09-05 00:41:11 +00:00
|
|
|
/* Format the broken-down time *__TP, with additional __NS nanoseconds,
|
2024-02-15 05:18:25 +00:00
|
|
|
into the buffer __S of size __MAXSIZE, according to the rules of the
|
|
|
|
LC_TIME category of the current locale.
|
|
|
|
|
2024-09-05 00:41:11 +00:00
|
|
|
Use the time zone __TZ.
|
2024-02-15 05:18:25 +00:00
|
|
|
If *__TP represents local time, __TZ should be set to
|
|
|
|
tzalloc (getenv ("TZ")).
|
|
|
|
If *__TP represents universal time (a.k.a. GMT), __TZ should be set to
|
|
|
|
(timezone_t) 0.
|
|
|
|
|
|
|
|
The format string __FORMAT, including GNU extensions, is described in
|
|
|
|
the GNU libc's strftime() documentation:
|
|
|
|
<https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html>
|
|
|
|
Additionally, the following conversion is supported:
|
|
|
|
%N The number of nanoseconds, passed as __NS argument.
|
|
|
|
Here's a summary of the available conversions (= format directives):
|
|
|
|
literal characters %n %t %%
|
|
|
|
date:
|
|
|
|
century %C
|
|
|
|
year %Y %y
|
|
|
|
week-based year %G %g
|
|
|
|
month (in year) %m %B %b %h
|
|
|
|
week in year %U %W %V
|
|
|
|
day in year %j
|
|
|
|
day (in month) %d %e
|
|
|
|
day in week %u %w %A %a
|
|
|
|
year, month, day %x %F %D
|
|
|
|
time:
|
|
|
|
half-day %p %P
|
|
|
|
hour %H %k %I %l
|
|
|
|
minute (in hour) %M
|
|
|
|
hour, minute %R
|
|
|
|
second (in minute) %S
|
|
|
|
hour, minute, second %r %T %X
|
|
|
|
second (since epoch) %s
|
|
|
|
date and time: %c
|
|
|
|
time zone: %z %Z
|
|
|
|
nanosecond %N
|
|
|
|
|
2024-09-05 00:41:11 +00:00
|
|
|
Store the result, as a string with a trailing NUL character, at the
|
|
|
|
beginning of the array __S[0..__MAXSIZE-1] and return the length of
|
|
|
|
that string, not counting the trailing NUL, and without changing errno.
|
|
|
|
If unsuccessful, possibly change the array __S, set errno, and return 0;
|
|
|
|
errno == ERANGE means the string didn't fit.
|
2024-02-15 05:18:25 +00:00
|
|
|
|
|
|
|
This function is like strftime, but with two more arguments:
|
|
|
|
* __TZ instead of the local timezone information,
|
|
|
|
* __NS as the number of nanoseconds in the %N directive.
|
|
|
|
*/
|
|
|
|
size_t nstrftime (char *restrict __s, size_t __maxsize,
|
|
|
|
char const *__format,
|
|
|
|
struct tm const *__tp, timezone_t __tz, int __ns);
|
|
|
|
|
|
|
|
/* Like nstrftime, except that it uses the "C" locale instead of the
|
|
|
|
current locale. */
|
|
|
|
size_t c_nstrftime (char *restrict __s, size_t __maxsize,
|
|
|
|
char const *__format,
|
|
|
|
struct tm const *__tp, timezone_t __tz, int __ns);
|
2011-01-30 23:34:18 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|