]> Savannah Git Hosting - gnulib.git/commitdiff
asctime, ctime: deprecate
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Dec 2022 21:25:39 +0000 (13:25 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Dec 2022 21:26:13 +0000 (13:26 -0800)
C23 deprecates asctime and ctime, so deprecate them in Gnulib too.
* NEWS, doc/posix-functions/asctime.texi:
* doc/posix-functions/ctime.texi: Mention this.
* lib/time.in.h (ctime): Deprecate any ctime replacement.
* modules/ctime: Now obsolete.

ChangeLog
NEWS
doc/posix-functions/asctime.texi
doc/posix-functions/ctime.texi
lib/time.in.h
modules/ctime

index d7f0a62ed947d5d2bb195b881ff273a512944d6a..66518b7a282d3df2703c10d7b6102df1ab6feaf2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-12-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       asctime, ctime: deprecate
+       C23 deprecates asctime and ctime, so deprecate them in Gnulib too.
+       * NEWS, doc/posix-functions/asctime.texi:
+       * doc/posix-functions/ctime.texi: Mention this.
+       * lib/time.in.h (ctime): Deprecate any ctime replacement.
+       * modules/ctime: Now obsolete.
+
 2022-12-17  Paul Eggert  <eggert@cs.ucla.edu>
 
        memset_explicit: port to older MS-Windows
diff --git a/NEWS b/NEWS
index 3b83e2978dab2f534214f021216c58a53dd99628..bc620ce86a75a2c9454e64b2655f6d0da4be4a8c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2022-12-21  ctime           This module is deprecated.  Use localtime_r
+                            and strftime (or even sprintf) instead.
+
 2022-11-03  dynarray        These modules are renamed to glibc-internal/dynarray
             scratch_buffer  and glibc-internal/scratch_buffer, respectively.
                             They are not meant for general use.
index c7dce36f6d9a0d2bd365763a175c74d4c8a252da..5c4654a866527707cf90c69cad525a1fecb22650 100644 (file)
@@ -13,5 +13,8 @@ Portability problems fixed by Gnulib:
 Portability problems not fixed by Gnulib:
 @itemize
 @item
+This function is deprecated in C23.
+Portable applications can use @code{strftime} (or even @code{sprintf}) instead.
+@item
 This function may overflow its internal buffer if an invalid year is passed.
 @end itemize
index d9e194c2b3ef5dac210640a98ed4689e169aa3fe..bb6abb23a80d4ef2cd13a86604bee667cbbac580 100644 (file)
@@ -16,6 +16,10 @@ when the environment variable @code{TZ} has been set by Cygwin.
 Portability problems not fixed by Gnulib:
 @itemize
 @item
+This function is deprecated in C23.
+Portable applications can use @code{localtime_r} and @code{strftime}
+(or even @code{sprintf}) instead.
+@item
 This function may overflow its internal buffer if an invalid year is passed.
 @item
 The @code{ctime} function need not be reentrant, and consequently is
index 6aa67498f57533d4a38c3af800766cf673ccfc49..aba2eda87597915093cd7fe16eda8f81b210d601 100644 (file)
@@ -315,6 +315,7 @@ _GL_CXXALIASWARN (strptime);
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #    define ctime rpl_ctime
 #   endif
+_GL_ATTRIBUTE_DEPRECATED
 _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp)
                                  _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
index 949f849b91ea2b275e7cdc51d53e2ad70e0f91e0..2a602dc2c3bdc9ea91763df848b4c032a02a721c 100644 (file)
@@ -1,6 +1,12 @@
 Description:
 ctime() function: convert time to string.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
 lib/ctime.c
 m4/ctime.m4