summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2010-10-05 11:40:11 -0600
committerEric Blake <eblake@redhat.com>2010-10-05 12:05:18 -0600
commit2bb63bfb25474ea147ee9f1523c0337997359a4c (patch)
treec55d0e048d3cdeece00e2817d37f519c2069bd93
parent03e00599acea10d2f8927b7d243ad95a0b680f3c (diff)
downloadgnulib-2bb63bfb25474ea147ee9f1523c0337997359a4c.tar.gz
parse-datetime: better name than get_date
* NEWS: Reword the deprecation notice. * modules/get_date: Rename to modules/parse-datetime. * modules/get_date-tests: Rename to modules/parse-datetime-tests. * m4/get_date.m4: Rename to m4/parse-datetime.m4. * lib/get_date.y: Rename to lib/parse-datetime.y. * tests/test-get_date.c: Rename to tests/test-parse-datetime.c. * doc/get_date.texi: Rename to doc/parse-datetime.texi. * doc/getdate.texi: Provide fallback wrapper. * lib/getdate.h: Move guts, and wrap... * lib/parse-datetime.h: ...new file. * lib/parse-datetime.y (get_date): Rename... (parse_datetime): ...to this. * m4/parse-datetime.m4 (gl_GET_DATE): Rename... (gl_PARSE_DATETIME): ...to this. * doc/posix-functions/getdate.texi (get_date): Provide fallback documentation. * modules/getdate (Files): Provide fallback docs and header. (Notice, Depends-on): Update references. * tests/test-parse-datetime.c: Likewise. * DEPENDENCIES: Likewise. * MODULES.html.sh (Date and time <time.h>): Likewise. * doc/parse-datetime.texi (Date input formats) (Authors of parse_datetime): Likewise. * modules/parse-datetime (Files, configure.ac, Makefile.am) (Include): Likewise. * modules/parse-datetime-tests (Files, Makefile.am): Likewise. * gnulib-tool: Likewise. * m4/bison.m4 (gl_BISON): Likewise. Suggested by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r--ChangeLog31
-rw-r--r--DEPENDENCIES2
-rwxr-xr-xMODULES.html.sh2
-rw-r--r--NEWS10
-rw-r--r--doc/getdate.texi1
-rw-r--r--doc/parse-datetime.texi (renamed from doc/get_date.texi)19
-rw-r--r--doc/posix-functions/getdate.texi4
-rwxr-xr-xgnulib-tool2
-rw-r--r--lib/getdate.h25
-rw-r--r--lib/parse-datetime.h22
-rw-r--r--lib/parse-datetime.y (renamed from lib/get_date.y)7
-rw-r--r--m4/bison.m42
-rw-r--r--m4/parse-datetime.m4 (renamed from m4/get_date.m4)8
-rw-r--r--modules/get_date52
-rw-r--r--modules/get_date-tests14
-rw-r--r--modules/getdate6
-rw-r--r--modules/parse-datetime52
-rw-r--r--modules/parse-datetime-tests14
-rw-r--r--tests/test-parse-datetime.c (renamed from tests/test-get_date.c)72
19 files changed, 194 insertions, 151 deletions
diff --git a/ChangeLog b/ChangeLog
index 6cf569a791..4345d5e86a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,37 @@
2010-10-05 Eric Blake <eblake@redhat.com>
+ parse-datetime: better name than get_date
+ * NEWS: Reword the deprecation notice.
+ * modules/get_date: Rename to modules/parse-datetime.
+ * modules/get_date-tests: Rename to modules/parse-datetime-tests.
+ * m4/get_date.m4: Rename to m4/parse-datetime.m4.
+ * lib/get_date.y: Rename to lib/parse-datetime.y.
+ * tests/test-get_date.c: Rename to tests/test-parse-datetime.c.
+ * doc/get_date.texi: Rename to doc/parse-datetime.texi.
+ * doc/getdate.texi: Provide fallback wrapper.
+ * lib/getdate.h: Move guts, and wrap...
+ * lib/parse-datetime.h: ...new file.
+ * lib/parse-datetime.y (get_date): Rename...
+ (parse_datetime): ...to this.
+ * m4/parse-datetime.m4 (gl_GET_DATE): Rename...
+ (gl_PARSE_DATETIME): ...to this.
+ * doc/posix-functions/getdate.texi (get_date): Provide fallback
+ documentation.
+ * modules/getdate (Files): Provide fallback docs and header.
+ (Notice, Depends-on): Update references.
+ * tests/test-parse-datetime.c: Likewise.
+ * DEPENDENCIES: Likewise.
+ * MODULES.html.sh (Date and time <time.h>): Likewise.
+ * doc/parse-datetime.texi (Date input formats)
+ (Authors of parse_datetime): Likewise.
+ * modules/parse-datetime (Files, configure.ac, Makefile.am)
+ (Include): Likewise.
+ * modules/parse-datetime-tests (Files, Makefile.am): Likewise.
+ * gnulib-tool: Likewise.
+ * m4/bison.m4 (gl_BISON): Likewise.
+ Suggested by Bruno Haible.
+
bootstrap: fix Solaris regression
* build-aux/bootstrap (check_versions): Solaris tr still needs []
around ranges.
diff --git a/DEPENDENCIES b/DEPENDENCIES
index b4ec630668..2117e7dbce 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -101,7 +101,7 @@ at any time.
* Bison 2.0 or newer.
+ Recommended.
- Needed if you use the 'get_date' module.
+ Needed if you use the 'parse-datetime' module.
+ Homepage:
http://www.gnu.org/software/bison/
+ Download:
diff --git a/MODULES.html.sh b/MODULES.html.sh
index c356b0157f..eb5b642d36 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -1835,7 +1835,7 @@ func_all_modules ()
func_echo "$element"
func_begin_table
- func_module get_date
+ func_module parse-datetime
func_module timegm
func_module tzset
func_end_table
diff --git a/NEWS b/NEWS
index 20cc20ded3..76239ddb03 100644
--- a/NEWS
+++ b/NEWS
@@ -12,10 +12,12 @@ User visible incompatible changes
Date Modules Changes
-2010-09-30 getdate This module is deprecated. Please use get_date
- for get_date(), or help us write getdate-posix
- for getdate(). Also, doc/getdate.texi has been
- renamed to doc/get_date.texi.
+2010-10-05 getdate This module is deprecated. Please use the new
+ parse-datetime module for the replacement
+ function parse_datetime(), or help us write
+ getdate-posix for getdate(). Also, the header
+ "getdate.h" has been renamed "parse-datetime.h",
+ and doc/getdate.texi to doc/parse-datetime.texi.
2010-09-29 sys_wait This module no longer provides the waitpid()
function. If you need this function, you now need
diff --git a/doc/getdate.texi b/doc/getdate.texi
new file mode 100644
index 0000000000..099b1bb01e
--- /dev/null
+++ b/doc/getdate.texi
@@ -0,0 +1 @@
+@include parse-datetime.texi
diff --git a/doc/get_date.texi b/doc/parse-datetime.texi
index 85c39f5a92..496709cc35 100644
--- a/doc/get_date.texi
+++ b/doc/parse-datetime.texi
@@ -14,7 +14,7 @@
@chapter Date input formats
@cindex date input formats
-@findex get_date
+@findex parse_datetime
First, a quote:
@@ -45,7 +45,7 @@ or a week from Sunday, with feelings of helpless confusion. @dots{}
This section describes the textual date representations that @sc{gnu}
programs accept. These are the strings you, as a user, can supply as
arguments to the various programs. The C interface (via the
-@code{get_date} function) is not described here.
+@code{parse_datetime} function) is not described here.
@menu
* General date syntax:: Common rules.
@@ -57,7 +57,7 @@ arguments to the various programs. The C interface (via the
* Pure numbers in date strings:: 19931219, 1440.
* Seconds since the Epoch:: @@1078100502.
* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0".
-* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al.
+* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al.
@end menu
@@ -530,10 +530,12 @@ daylight saving time; other rules can specify simple daylight saving
regimes. @xref{TZ Variable,, Specifying the Time Zone with @code{TZ},
libc, The GNU C Library}.
-@node Authors of get_date
-@section Authors of @code{get_date}
+@node Authors of parse_datetime
+@section Authors of @code{parse_datetime}
+@c the anchor keeps the old node name, to try to avoid breaking links
+@anchor{Authors of get_date}
-@cindex authors of @code{get_date}
+@cindex authors of @code{parse_datetime}
@cindex Bellovin, Steven M.
@cindex Salz, Rich
@@ -547,10 +549,11 @@ at Chapel Hill. The code was later tweaked by a couple of people on
Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
-Paul Eggert and others.
+Paul Eggert and others, including renaming it to @code{parse_datetime}
+to avoid confusion with the Posix function @code{getdate}.
@cindex Pinard, F.
@cindex Berry, K.
This chapter was originally produced by Fran@,{c}ois Pinard
-(@email{pinard@@iro.umontreal.ca}) from the @file{get_date.y} source code,
+(@email{pinard@@iro.umontreal.ca}) from the @file{parse_datetime.y} source code,
and then edited by K.@: Berry (@email{kb@@cs.umb.edu}).
diff --git a/doc/posix-functions/getdate.texi b/doc/posix-functions/getdate.texi
index 156713aeb2..144c2c7404 100644
--- a/doc/posix-functions/getdate.texi
+++ b/doc/posix-functions/getdate.texi
@@ -17,6 +17,6 @@ This function is missing on some platforms:
MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Cygwin, mingw, BeOS.
@end itemize
-Gnulib provides a module @code{get_date} that contains a function
-@code{get_date}
+Gnulib provides a module @code{parse-datetime} that contains a function
+@code{parse_datetime}
that has similar functionality as the @code{getdate} function.
diff --git a/gnulib-tool b/gnulib-tool
index afd6493691..0e1694d76f 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -5354,7 +5354,7 @@ func_create_testdir ()
) || func_exit 1
fi
# Need to run configure and make once, to create built files that are to be
- # distributed (such as get_date.c).
+ # distributed (such as parse-datetime.c).
sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
# Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
diff --git a/lib/getdate.h b/lib/getdate.h
index 22cc2c02a3..9f5d1a9d5a 100644
--- a/lib/getdate.h
+++ b/lib/getdate.h
@@ -1,22 +1,3 @@
-/* Parse a string into an internal time stamp.
-
- Copyright (C) 1995, 1997, 1998, 2003, 2004, 2007, 2009, 2010 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <stdbool.h>
-#include <time.h>
-
-bool get_date (struct timespec *, char const *, struct timespec const *);
+/* Obsolete; consider using parse-datetime.h instead. */
+#include "parse-datetime.h"
+#define get_date(a, b, c) parse_datetime (a, b, c)
diff --git a/lib/parse-datetime.h b/lib/parse-datetime.h
new file mode 100644
index 0000000000..9685d9ba48
--- /dev/null
+++ b/lib/parse-datetime.h
@@ -0,0 +1,22 @@
+/* Parse a string into an internal time stamp.
+
+ Copyright (C) 1995, 1997, 1998, 2003, 2004, 2007, 2009, 2010 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdbool.h>
+#include <time.h>
+
+bool parse_datetime (struct timespec *, char const *, struct timespec const *);
diff --git a/lib/get_date.y b/lib/parse-datetime.y
index 445865bdb8..f22c754e0f 100644
--- a/lib/get_date.y
+++ b/lib/parse-datetime.y
@@ -33,7 +33,7 @@
#include <config.h>
-#include "getdate.h"
+#include "parse-datetime.h"
#include "intprops.h"
#include "timespec.h"
@@ -1201,7 +1201,8 @@ get_tz (char tzbuf[TZBUFSIZE])
P can be an incomplete or relative time specification; if so, use
*NOW as the basis for the returned time. */
bool
-get_date (struct timespec *result, char const *p, struct timespec const *now)
+parse_datetime (struct timespec *result, char const *p,
+ struct timespec const *now)
{
time_t Start;
long int Start_ns;
@@ -1550,7 +1551,7 @@ main (int ac, char **av)
{
struct timespec d;
struct tm const *tm;
- if (! get_date (&d, buff, NULL))
+ if (! parse_datetime (&d, buff, NULL))
printf ("Bad format - couldn't convert.\n");
else if (! (tm = localtime (&d.tv_sec)))
{
diff --git a/m4/bison.m4 b/m4/bison.m4
index e9272cbfae..bd8225dd5b 100644
--- a/m4/bison.m4
+++ b/m4/bison.m4
@@ -7,7 +7,7 @@
AC_DEFUN([gl_BISON],
[
- # get_date.y works with bison only.
+ # parse-datetime.y works with bison only.
: ${YACC='bison -y'}
dnl
dnl Declaring YACC & YFLAGS precious will not be necessary after GNULIB
diff --git a/m4/get_date.m4 b/m4/parse-datetime.m4
index b71da82176..d7812922ba 100644
--- a/m4/get_date.m4
+++ b/m4/parse-datetime.m4
@@ -1,4 +1,4 @@
-# get_date.m4 serial 17
+# parse-datetime.m4 serial 18
dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,13 +24,13 @@ AC_DEFUN([gl_C_COMPOUND_LITERALS],
fi
])
-AC_DEFUN([gl_GET_DATE],
+AC_DEFUN([gl_PARSE_DATETIME],
[
- dnl Prerequisites of lib/getdate.h.
+ dnl Prerequisites of lib/parse-datetime.h.
AC_REQUIRE([AM_STDBOOL_H])
AC_REQUIRE([gl_TIMESPEC])
- dnl Prerequisites of lib/get_date.y.
+ dnl Prerequisites of lib/parse-datetime.y.
AC_REQUIRE([gl_BISON])
AC_REQUIRE([gl_C_COMPOUND_LITERALS])
AC_STRUCT_TIMEZONE
diff --git a/modules/get_date b/modules/get_date
deleted file mode 100644
index e3997ac5c8..0000000000
--- a/modules/get_date
+++ /dev/null
@@ -1,52 +0,0 @@
-Description:
-Convert a date/time string to linear time.
-
-Files:
-doc/get_date.texi
-lib/getdate.h
-lib/get_date.y
-m4/bison.m4
-m4/tm_gmtoff.m4
-m4/get_date.m4
-
-Depends-on:
-c-ctype
-stdbool
-gettime
-intprops
-mktime
-setenv
-unsetenv
-time
-verify
-xalloc
-
-configure.ac:
-gl_GET_DATE
-
-Makefile.am:
-# This rule overrides the Automake generated .y.c rule, to ensure that the
-# get_date.c file gets generated in the source directory, not in the build
-# directory.
-get_date.c: get_date.y
- $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/get_date.y \
- y.tab.c get_date.c \
- y.tab.h getdate.h \
- y.output get_date.output \
- -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \
- mv get_date.c get_date.c-t && \
- mv get_date.c-t $(srcdir)/get_date.c
-lib_SOURCES += get_date.y
-BUILT_SOURCES += get_date.c
-MOSTLYCLEANFILES += get_date.c-t
-MAINTAINERCLEANFILES += get_date.c
-EXTRA_DIST += get_date.c
-
-Include:
-"getdate.h"
-
-License:
-GPL
-
-Maintainer:
-Paul Eggert
diff --git a/modules/get_date-tests b/modules/get_date-tests
deleted file mode 100644
index cb96ff6e1d..0000000000
--- a/modules/get_date-tests
+++ /dev/null
@@ -1,14 +0,0 @@
-Files:
-tests/test-get_date.c
-tests/macros.h
-
-Depends-on:
-progname
-setenv
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-get_date
-check_PROGRAMS += test-get_date
-test_get_date_LDADD = $(LDADD) @LIBINTL@ $(LIB_CLOCK_GETTIME)
diff --git a/modules/getdate b/modules/getdate
index 2f23036151..5dca5cfdc9 100644
--- a/modules/getdate
+++ b/modules/getdate
@@ -5,12 +5,14 @@ Status:
obsolete
Notice:
-This module is obsolete. Use the module 'get_date' instead.
+This module is obsolete. Use the module 'parse-datetime' instead.
Files:
+doc/getdate.texi
+lib/getdate.h
Depends-on:
-get_date
+parse-datetime
configure.ac:
diff --git a/modules/parse-datetime b/modules/parse-datetime
new file mode 100644
index 0000000000..4842706864
--- /dev/null
+++ b/modules/parse-datetime
@@ -0,0 +1,52 @@
+Description:
+Convert a date/time string to linear time.
+
+Files:
+doc/parse-datetime.texi
+lib/parse-datetime.h
+lib/parse-datetime.y
+m4/bison.m4
+m4/tm_gmtoff.m4
+m4/parse-datetime.m4
+
+Depends-on:
+c-ctype
+stdbool
+gettime
+intprops
+mktime
+setenv
+unsetenv
+time
+verify
+xalloc
+
+configure.ac:
+gl_PARSE_DATETIME
+
+Makefile.am:
+# This rule overrides the Automake generated .y.c rule, to ensure that the
+# parse-datetime.c file gets generated in the source directory, not in the
+# build directory.
+parse-datetime.c: parse-datetime.y
+ $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/parse-datetime.y \
+ y.tab.c parse-datetime.c \
+ y.tab.h parse-datetime.h \
+ y.output parse-datetime.output \
+ -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \
+ mv parse-datetime.c parse-datetime.c-t && \
+ mv parse-datetime.c-t $(srcdir)/parse-datetime.c
+lib_SOURCES += parse-datetime.y
+BUILT_SOURCES += parse-datetime.c
+MOSTLYCLEANFILES += parse-datetime.c-t
+MAINTAINERCLEANFILES += parse-datetime.c
+EXTRA_DIST += parse-datetime.c
+
+Include:
+"parse-datetime.h"
+
+License:
+GPL
+
+Maintainer:
+Paul Eggert
diff --git a/modules/parse-datetime-tests b/modules/parse-datetime-tests
new file mode 100644
index 0000000000..04feed2f0f
--- /dev/null
+++ b/modules/parse-datetime-tests
@@ -0,0 +1,14 @@
+Files:
+tests/test-parse-datetime.c
+tests/macros.h
+
+Depends-on:
+progname
+setenv
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-parse-datetime
+check_PROGRAMS += test-parse-datetime
+test_parse_datetime_LDADD = $(LDADD) @LIBINTL@ $(LIB_CLOCK_GETTIME)
diff --git a/tests/test-get_date.c b/tests/test-parse-datetime.c
index 5f7095c5c9..bc90209c4f 100644
--- a/tests/test-get_date.c
+++ b/tests/test-parse-datetime.c
@@ -1,4 +1,4 @@
-/* Test of getdate() function.
+/* Test of parse_datetime() function.
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,7 @@
#include <config.h>
-#include "getdate.h"
+#include "parse-datetime.h"
#include <stdio.h>
#include <stdlib.h>
@@ -62,14 +62,14 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "now";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
ASSERT (now.tv_sec == result.tv_sec && now.tv_nsec == result.tv_nsec);
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "tomorrow";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
ASSERT (now.tv_sec + 24 * 60 * 60 == result.tv_sec
&& now.tv_nsec == result.tv_nsec);
@@ -77,7 +77,7 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "yesterday";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
ASSERT (now.tv_sec - 24 * 60 * 60 == result.tv_sec
&& now.tv_nsec == result.tv_nsec);
@@ -85,7 +85,7 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "4 hours";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
ASSERT (now.tv_sec + 4 * 60 * 60 == result.tv_sec
&& now.tv_nsec == result.tv_nsec);
@@ -94,10 +94,10 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+400 +24 hours";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC+400 +1 day";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
@@ -106,15 +106,15 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+14:00";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC+14";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
p = "UTC+1400";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
@@ -122,15 +122,15 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC-14:00";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC-14";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
p = "UTC-1400";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
@@ -138,10 +138,10 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+0:15";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC+0015";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
@@ -149,65 +149,65 @@ main (int argc _GL_UNUSED, char **argv)
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC-1:30";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC-130";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
- /* TZ out of range should cause get_date failure */
+ /* TZ out of range should cause parse_datetime failure */
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+25:00";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
/* Check for several invalid countable dayshifts */
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+4:00 +40 yesterday";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
p = "UTC+4:00 next yesterday";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
p = "UTC+4:00 tomorrow ago";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
p = "UTC+4:00 40 now ago";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
p = "UTC+4:00 last tomorrow";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
p = "UTC+4:00 -4 today";
- ASSERT (!get_date (&result, p, &now));
+ ASSERT (!parse_datetime (&result, p, &now));
/* And check correct usage of dayshifts */
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+400 tomorrow";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC+400 +1 day";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+400 yesterday";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC+400 1 day ago";
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "UTC+400 now";
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
p = "UTC+400 +0 minutes"; /* silly, but simple "UTC+400" is different*/
- ASSERT (get_date (&result2, p, &now));
+ ASSERT (parse_datetime (&result2, p, &now));
LOG (p, now, result2);
ASSERT (result.tv_sec == result2.tv_sec
&& result.tv_nsec == result2.tv_nsec);
@@ -221,7 +221,7 @@ main (int argc _GL_UNUSED, char **argv)
sprintf (tmp, "NEXT %s", day_table[i]);
now.tv_sec = thur2 + 4711;
now.tv_nsec = 1267;
- ASSERT (get_date (&result, tmp, &now));
+ ASSERT (parse_datetime (&result, tmp, &now));
LOG (tmp, now, result);
ASSERT (result.tv_nsec == 0);
ASSERT (result.tv_sec == thur2 + (i == 4 ? 7 : (i + 3) % 7) * 24 * 3600);
@@ -229,7 +229,7 @@ main (int argc _GL_UNUSED, char **argv)
sprintf (tmp, "LAST %s", day_table[i]);
now.tv_sec = thur2 + 4711;
now.tv_nsec = 1267;
- ASSERT (get_date (&result, tmp, &now));
+ ASSERT (parse_datetime (&result, tmp, &now));
LOG (tmp, now, result);
ASSERT (result.tv_nsec == 0);
ASSERT (result.tv_sec == thur2 + ((i + 3) % 7 - 7) * 24 * 3600);
@@ -238,7 +238,7 @@ main (int argc _GL_UNUSED, char **argv)
p = "THURSDAY UTC+00"; /* The epoch was on Thursday. */
now.tv_sec = 0;
now.tv_nsec = 0;
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
ASSERT (result.tv_sec == now.tv_sec
&& result.tv_nsec == now.tv_nsec);
@@ -246,7 +246,7 @@ main (int argc _GL_UNUSED, char **argv)
p = "FRIDAY UTC+00";
now.tv_sec = 0;
now.tv_nsec = 0;
- ASSERT (get_date (&result, p, &now));
+ ASSERT (parse_datetime (&result, p, &now));
LOG (p, now, result);
ASSERT (result.tv_sec == 24 * 3600
&& result.tv_nsec == now.tv_nsec);