bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] parse-datetime: better name than get_date


From: Eric Blake
Subject: [PATCH] parse-datetime: better name than get_date
Date: Tue, 5 Oct 2010 11:42:43 -0600

* 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 <address@hidden>
---

I believe this gets it all.  After a bit more testing with
coreutils, I'll push this.

 ChangeLog                                        |   31 +++++++++
 DEPENDENCIES                                     |    2 +-
 MODULES.html.sh                                  |    2 +-
 NEWS                                             |   10 ++-
 doc/getdate.texi                                 |    1 +
 doc/{get_date.texi => parse-datetime.texi}       |   17 +++---
 doc/posix-functions/getdate.texi                 |    4 +-
 gnulib-tool                                      |    2 +-
 lib/getdate.h                                    |   25 +-------
 lib/parse-datetime.h                             |   22 +++++++
 lib/{get_date.y => parse-datetime.y}             |    7 +-
 m4/bison.m4                                      |    2 +-
 m4/{get_date.m4 => parse-datetime.m4}            |    8 +-
 modules/get_date                                 |   52 ----------------
 modules/get_date-tests                           |   14 ----
 modules/getdate                                  |    6 +-
 modules/parse-datetime                           |   52 ++++++++++++++++
 modules/parse-datetime-tests                     |   14 ++++
 tests/{test-get_date.c => test-parse-datetime.c} |   72 +++++++++++-----------
 19 files changed, 192 insertions(+), 151 deletions(-)
 create mode 100644 doc/getdate.texi
 rename doc/{get_date.texi => parse-datetime.texi} (97%)
 create mode 100644 lib/parse-datetime.h
 rename lib/{get_date.y => parse-datetime.y} (99%)
 rename m4/{get_date.m4 => parse-datetime.m4} (92%)
 delete mode 100644 modules/get_date
 delete mode 100644 modules/get_date-tests
 create mode 100644 modules/parse-datetime
 create mode 100644 modules/parse-datetime-tests
 rename tests/{test-get_date.c => test-parse-datetime.c} (78%)

diff --git a/ChangeLog b/ChangeLog
index e37577a..c024890 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,36 @@
 2010-10-05  Eric Blake  <address@hidden>

+       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 b4ec630..2117e7d 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 c356b01..eb5b642 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 20cc20d..76239dd 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 0000000..099b1bb
--- /dev/null
+++ b/doc/getdate.texi
@@ -0,0 +1 @@
address@hidden parse-datetime.texi
diff --git a/doc/get_date.texi b/doc/parse-datetime.texi
similarity index 97%
rename from doc/get_date.texi
rename to doc/parse-datetime.texi
index 85c39f5..c4be0ef 100644
--- a/doc/get_date.texi
+++ b/doc/parse-datetime.texi
@@ -14,7 +14,7 @@ Date input formats
 @chapter Date input formats

 @cindex date input formats
address@hidden get_date
address@hidden parse_datetime

 First, a quote:

@@ -45,7 +45,7 @@ Date input formats
 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
address@hidden function) is not described here.
address@hidden function) is not described here.

 @menu
 * General date syntax::            Common rules.
@@ -57,7 +57,7 @@ Date input formats
 * 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,10 @@ Specifying time zone rules
 regimes.  @xref{TZ Variable,, Specifying the Time Zone with @code{TZ},
 libc, The GNU C Library}.

address@hidden Authors of get_date
address@hidden Authors of @code{get_date}
address@hidden Authors of parse_datetime
address@hidden Authors of @code{parse_datetime}

address@hidden authors of @code{get_date}
address@hidden authors of @code{parse_datetime}

 @cindex Bellovin, Steven M.
 @cindex Salz, Rich
@@ -547,10 +547,11 @@ Authors of get_date
 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 156713a..144c2c7 100644
--- a/doc/posix-functions/getdate.texi
+++ b/doc/posix-functions/getdate.texi
@@ -17,6 +17,6 @@ getdate
 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
address@hidden
+Gnulib provides a module @code{parse-datetime} that contains a function
address@hidden
 that has similar functionality as the @code{getdate} function.
diff --git a/gnulib-tool b/gnulib-tool
index b89c2eb..c5f14fa 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 22cc2c0..9f5d1a9 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 0000000..9685d9b
--- /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
similarity index 99%
rename from lib/get_date.y
rename to lib/parse-datetime.y
index 445865b..f22c754 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 e9272cb..bd8225d 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
similarity index 92%
rename from m4/get_date.m4
rename to m4/parse-datetime.m4
index b71da82..d781292 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 e3997ac..0000000
--- 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 cb96ff6..0000000
--- 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 2f23036..5a9996b 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.h
+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 0000000..4842706
--- /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 0000000..04feed2
--- /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
similarity index 78%
rename from tests/test-get_date.c
rename to tests/test-parse-datetime.c
index 5f7095c..bc90209 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);
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]