[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/gl
From: |
shishi-commit |
Subject: |
CVS shishi/gl |
Date: |
Fri, 17 Dec 2004 14:44:06 +0100 |
Update of /home/cvs/shishi/gl
In directory dopio:/tmp/cvs-serv20748/gl
Modified Files:
getdate.y mktime.c
Log Message:
Update.
--- /home/cvs/shishi/gl/getdate.y 2004/11/19 14:04:23 1.9
+++ /home/cvs/shishi/gl/getdate.y 2004/12/17 13:44:05 1.10
@@ -108,6 +108,7 @@
representation. */
typedef struct
{
+ bool negative;
long int value;
size_t digits;
} textint;
@@ -179,6 +180,7 @@
union YYSTYPE;
static int yylex (union YYSTYPE *, parser_control *);
static int yyerror (parser_control *, char *);
+static long int time_zone_hhmm (textint, long int);
%}
@@ -188,8 +190,8 @@
%parse-param { parser_control *pc }
%lex-param { parser_control *pc }
-/* This grammar has 13 shift/reduce conflicts. */
-%expect 13
+/* This grammar has 14 shift/reduce conflicts. */
+%expect 14
%union
{
@@ -207,7 +209,7 @@
%token <textintval> tSNUMBER tUNUMBER
%token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER
-%type <intval> o_merid
+%type <intval> o_colon_minutes o_merid
%type <timespec> seconds signed_seconds unsigned_seconds
%%
@@ -263,7 +265,7 @@
pc->seconds.tv_nsec = 0;
pc->meridian = $4;
}
- | tUNUMBER ':' tUNUMBER tSNUMBER
+ | tUNUMBER ':' tUNUMBER tSNUMBER o_colon_minutes
{
pc->hour = $1.value;
pc->minutes = $3.value;
@@ -271,7 +273,7 @@
pc->seconds.tv_nsec = 0;
pc->meridian = MER24;
pc->zones_seen++;
- pc->time_zone = $4.value % 100 + ($4.value / 100) * 60;
+ pc->time_zone = time_zone_hhmm ($4, $5);
}
| tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
{
@@ -280,14 +282,14 @@
pc->seconds = $5;
pc->meridian = $6;
}
- | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER
+ | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER o_colon_minutes
{
pc->hour = $1.value;
pc->minutes = $3.value;
pc->seconds = $5;
pc->meridian = MER24;
pc->zones_seen++;
- pc->time_zone = $6.value % 100 + ($6.value / 100) * 60;
+ pc->time_zone = time_zone_hhmm ($6, $7);
}
;
@@ -301,6 +303,8 @@
zone:
tZONE
{ pc->time_zone = $1; }
+ | tZONE tSNUMBER o_colon_minutes
+ { pc->time_zone = $1 + time_zone_hhmm ($2, $3); }
| tDAYZONE
{ pc->time_zone = $1 + 60; }
| tZONE tDST
@@ -523,6 +527,13 @@
}
;
+o_colon_minutes:
+ /* empty */
+ { $$ = -1; }
+ | ':' tUNUMBER
+ { $$ = $2.value; }
+ ;
+
o_merid:
/* empty */
{ $$ = MER24; }
@@ -709,6 +720,19 @@
+/* Convert a time zone expressed as HH:MM into an integer count of
+ minutes. If MM is negative, then S is of the form HHMM and needs
+ to be picked apart; otherwise, S is of the form HH. */
+
+static long int
+time_zone_hhmm (textint s, long int mm)
+{
+ if (mm < 0)
+ return (s.value / 100) * 60 + s.value % 100;
+ else
+ return s.value * 60 + (s.negative ? -mm : mm);
+}
+
static int
to_hour (long int hours, int meridian)
{
@@ -960,6 +984,7 @@
}
else
{
+ lvalp->textintval.negative = sign < 0;
if (sign < 0)
{
lvalp->textintval.value = - value;
--- /home/cvs/shishi/gl/mktime.c 2004/11/11 18:58:35 1.6
+++ /home/cvs/shishi/gl/mktime.c 2004/12/17 13:44:05 1.7
@@ -462,8 +462,9 @@
t2 = t1 + sec_adjustment;
if (((t1 < t) != (sec_requested < 0))
| ((t2 < t1) != (sec_adjustment < 0))
- | ! (*convert) (&t, &tm))
+ | ! (*convert) (&t2, &tm))
return -1;
+ t = t2;
}
*tp = tm;
- CVS shishi/gl, shishi-commit, 2004/12/01
- CVS shishi/gl, shishi-commit, 2004/12/01
- CVS shishi/gl, shishi-commit, 2004/12/01
- CVS shishi/gl, shishi-commit, 2004/12/01
- CVS shishi/gl,
shishi-commit <=
- CVS shishi/gl, shishi-commit, 2004/12/18
- CVS shishi/gl, shishi-commit, 2004/12/18
- CVS shishi/gl, shishi-commit, 2004/12/19
- CVS shishi/gl, shishi-commit, 2004/12/24