projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(DISTCLEANFILES): Add lstat.c and stat.c.
[gnulib.git]
/
lib
/
getdate.y
diff --git
a/lib/getdate.y
b/lib/getdate.y
index
2628974
..
658da69
100644
(file)
--- a/
lib/getdate.y
+++ b/
lib/getdate.y
@@
-73,7
+73,7
@@
# include <string.h>
#endif
# include <string.h>
#endif
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <
7)
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <
8) || __STRICT_ANSI__
# define __attribute__(x)
#endif
# define __attribute__(x)
#endif
@@
-99,7
+99,7
@@
enum { MERam, MERpm, MER24 };
/* Information passed to and from the parser. */
struct parser_control
/* Information passed to and from the parser. */
struct parser_control
-{
+{
/* The input string remaining to be parsed. */
const char *input;
/* The input string remaining to be parsed. */
const char *input;
@@
-503,7
+503,7
@@
static table const relative_time_table[] =
{ "TODAY", tMINUTE_UNIT, 0 },
{ "NOW", tMINUTE_UNIT, 0 },
{ "LAST", tUNUMBER, -1 },
{ "TODAY", tMINUTE_UNIT, 0 },
{ "NOW", tMINUTE_UNIT, 0 },
{ "LAST", tUNUMBER, -1 },
- { "THIS", t
MINUTE_UNIT,
0 },
+ { "THIS", t
UNUMBER,
0 },
{ "NEXT", tUNUMBER, 1 },
{ "FIRST", tUNUMBER, 1 },
/*{ "SECOND", tUNUMBER, 2 }, */
{ "NEXT", tUNUMBER, 1 },
{ "FIRST", tUNUMBER, 1 },
/*{ "SECOND", tUNUMBER, 2 }, */
@@
-831,7
+831,10
@@
yyerror (char *s ATTRIBUTE_UNUSED)
return 0;
}
return 0;
}
-/* ?? */
+/* Parse a date/time string P. Return the corresponding time_t value,
+ or (time_t) -1 if there is an error. P can be an incomplete or
+ relative time specification; if so, use *NOW as the basis for the
+ returned time. */
time_t
get_date (const char *p, const time_t *now)
{
time_t
get_date (const char *p, const time_t *now)
{
@@
-876,18
+879,18
@@
get_date (const char *p, const time_t *now)
/* Probe the names used in the next three calendar quarters, looking
for a tm_isdst different from the one we already have. */
{
/* Probe the names used in the next three calendar quarters, looking
for a tm_isdst different from the one we already have. */
{
- int
probe
;
- for (
probe = 1; probe <= 3; probe
++)
+ int
quarter
;
+ for (
quarter = 1; quarter <= 3; quarter
++)
{
{
- time_t probe = Start +
probe
* (90 * 24 * 60 * 60);
- struct tm *tm = localtime (&probe);
- if (
tm &&
tm->tm_zone
- && tm->tm_isdst != pc.local_time_zone_table[0].value)
+ time_t probe = Start +
quarter
* (90 * 24 * 60 * 60);
+ struct tm *
probe_
tm = localtime (&probe);
+ if (
probe_tm && probe_
tm->tm_zone
+ &&
probe_
tm->tm_isdst != pc.local_time_zone_table[0].value)
{
{
{
{
- pc.local_time_zone_table[1].name = tm->tm_zone;
+ pc.local_time_zone_table[1].name =
probe_
tm->tm_zone;
pc.local_time_zone_table[1].type = tLOCAL_ZONE;
pc.local_time_zone_table[1].type = tLOCAL_ZONE;
- pc.local_time_zone_table[1].value = tm->tm_isdst;
+ pc.local_time_zone_table[1].value =
probe_
tm->tm_isdst;
pc.local_time_zone_table[2].name = 0;
}
break;
pc.local_time_zone_table[2].name = 0;
}
break;