void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
/* From unixtime2tm.c */
-int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
+int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts, timelib_tzinfo* tz);
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
-/* Generated by re2c 0.9.7 on Wed Jun 15 02:15:30 2005 */
+/* Generated by re2c 0.9.7.dev on Wed Jun 15 09:20:28 2005 */
#line 1 "parse_date.re"
/*
+----------------------------------------------------------------------+
#include "timelib_structs.h"
typedef struct timelib_elems {
- unsigned int c; /* Number of elements */
- char **v; /* Values */
+ unsigned int c; /* Number of elements */
+ char **v; /* Values */
} timelib_elems;
typedef struct Scanner {
- int fd;
- uchar *lim, *str, *ptr, *cur, *tok, *pos;
- unsigned int line, len;
+ int fd;
+ uchar *lim, *str, *ptr, *cur, *tok, *pos;
+ unsigned int line, len;
struct timelib_time *time;
} Scanner;
s->tok = cursor;
s->len = 0;
#line 844 "parse_date.re"
-{
+
static unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 40 "<stdout>"
+#line 783 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 118 "<stdout>"
+#line 861 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
printf("unexpected character: #%d, %c\n", *s->tok, *s->tok);
goto std;
}
-#line 184 "<stdout>"
+#line 927 "<stdout>"
yy8:
YYDEBUG(8, *YYCURSOR);
yyaccept = 0;
{
goto std;
}
-#line 843 "<stdout>"
+#line 1586 "<stdout>"
yy45:
YYDEBUG(45, *YYCURSOR);
++YYCURSOR;
s->pos = cursor; s->line++;
goto std;
}
-#line 852 "<stdout>"
+#line 1595 "<stdout>"
yy47:
YYDEBUG(47, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 1149 "<stdout>"
+#line 1892 "<stdout>"
yy82:
YYDEBUG(82, *YYCURSOR);
++YYCURSOR;
{
goto std;
}
-#line 1642 "<stdout>"
+#line 2385 "<stdout>"
yy149:
YYDEBUG(149, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 1685 "<stdout>"
+#line 2428 "<stdout>"
yy156:
YYDEBUG(156, *YYCURSOR);
yyaccept = 1;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2016 "<stdout>"
+#line 2759 "<stdout>"
yy189:
YYDEBUG(189, *YYCURSOR);
++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 3773 "<stdout>"
+#line 4516 "<stdout>"
yy387:
YYDEBUG(387, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 3832 "<stdout>"
+#line 4575 "<stdout>"
yy398:
YYDEBUG(398, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 3872 "<stdout>"
+#line 4615 "<stdout>"
yy405:
YYDEBUG(405, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 3994 "<stdout>"
+#line 4737 "<stdout>"
yy424:
YYDEBUG(424, *YYCURSOR);
yyaccept = 7;
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 5398 "<stdout>"
+#line 6141 "<stdout>"
yy560:
YYDEBUG(560, *YYCURSOR);
yyaccept = 1;
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 6829 "<stdout>"
+#line 7572 "<stdout>"
yy670:
YYDEBUG(670, *YYCURSOR);
yyaccept = 10;
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 6940 "<stdout>"
+#line 7683 "<stdout>"
yy685:
YYDEBUG(685, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 7035 "<stdout>"
+#line 7778 "<stdout>"
yy698:
YYDEBUG(698, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 7295 "<stdout>"
+#line 8038 "<stdout>"
yy757:
YYDEBUG(757, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 7588 "<stdout>"
+#line 8331 "<stdout>"
yy802:
YYDEBUG(802, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 7615 "<stdout>"
+#line 8358 "<stdout>"
yy806:
YYDEBUG(806, *YYCURSOR);
yyaccept = 11;
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 7786 "<stdout>"
+#line 8529 "<stdout>"
yy839:
YYDEBUG(839, *YYCURSOR);
yyaccept = 12;
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 8028 "<stdout>"
+#line 8771 "<stdout>"
yy879:
YYDEBUG(879, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 8241 "<stdout>"
+#line 8984 "<stdout>"
yy899:
YYDEBUG(899, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 8375 "<stdout>"
+#line 9118 "<stdout>"
yy920:
YYDEBUG(920, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 8411 "<stdout>"
+#line 9154 "<stdout>"
yy924:
YYDEBUG(924, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 8483 "<stdout>"
+#line 9226 "<stdout>"
yy931:
YYDEBUG(931, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 8547 "<stdout>"
+#line 9290 "<stdout>"
yy942:
YYDEBUG(942, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 9050 "<stdout>"
+#line 9793 "<stdout>"
yy1036:
YYDEBUG(1036, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 9688 "<stdout>"
+#line 10431 "<stdout>"
yy1117:
YYDEBUG(1117, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 9760 "<stdout>"
+#line 10503 "<stdout>"
yy1125:
YYDEBUG(1125, *YYCURSOR);
yyaccept = 19;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 9926 "<stdout>"
+#line 10669 "<stdout>"
yy1141:
YYDEBUG(1141, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 9967 "<stdout>"
+#line 10710 "<stdout>"
yy1150:
YYDEBUG(1150, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 9987 "<stdout>"
+#line 10730 "<stdout>"
yy1153:
YYDEBUG(1153, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 10012 "<stdout>"
+#line 10755 "<stdout>"
yy1156:
YYDEBUG(1156, *YYCURSOR);
yych = *++YYCURSOR;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 10052 "<stdout>"
+#line 10795 "<stdout>"
}
#line 1326 "parse_date.re"
-}
+
}
#define YYMAXFILL 25
#include "timelib_structs.h"
typedef struct timelib_elems {
- unsigned int c; /* Number of elements */
- char **v; /* Values */
+ unsigned int c; /* Number of elements */
+ char **v; /* Values */
} timelib_elems;
typedef struct Scanner {
- int fd;
- uchar *lim, *str, *ptr, *cur, *tok, *pos;
- unsigned int line, len;
+ int fd;
+ uchar *lim, *str, *ptr, *cur, *tok, *pos;
+ unsigned int line, len;
struct timelib_time *time;
} Scanner;
#include "timelib_structs.h"
typedef struct timelib_elems {
- unsigned int c; /* Number of elements */
- char **v; /* Values */
+ unsigned int c; /* Number of elements */
+ char **v; /* Values */
} timelib_elems;
typedef struct Scanner {
- int fd;
- uchar *lim, *str, *ptr, *cur, *tok, *pos;
- unsigned int line, len;
+ int fd;
+ uchar *lim, *str, *ptr, *cur, *tok, *pos;
+ unsigned int line, len;
struct timelib_time *time;
} Scanner;
} timelib_rel_time;
typedef struct timelib_time_offset {
- int32_t offset;
+ int32_t offset;
unsigned int leap_secs;
unsigned int is_dst;
- char *abbr;
+ char *abbr;
} timelib_time_offset;
typedef struct timelib_time {
- timelib_sll y, m, d; /* Year, Month, Day */
- timelib_sll h, i, s; /* Hour, mInute, Second */
- float f; /* Fraction */
- int z; /* GMT offset in minutes */
- char *tz_abbr; /* Timezone abbreviation (display only) */
- timelib_tzinfo *tz_info; /* Timezone structure */
- unsigned int dst; /* Flag if we were parsing a DST zone */
+ timelib_sll y, m, d; /* Year, Month, Day */
+ timelib_sll h, i, s; /* Hour, mInute, Second */
+ float f; /* Fraction */
+ int z; /* GMT offset in minutes */
+ char *tz_abbr; /* Timezone abbreviation (display only) */
+ timelib_tzinfo *tz_info; /* Timezone structure */
+ unsigned int dst; /* Flag if we were parsing a DST zone */
timelib_rel_time relative;
- timelib_sll sse; /* Seconds since epoch */
+ timelib_sll sse; /* Seconds since epoch */
unsigned int have_time, have_date, have_zone, have_relative, have_weekday_relative, have_weeknr_day;
- unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
- unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
- unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
- unsigned int zone_type; /* 1 time offset,
- * 3 TimeZone identifier,
- * 2 TimeZone abbreviation */
+ unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
+ unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
+ unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
+ unsigned int zone_type; /* 1 time offset,
+ * 3 TimeZone identifier,
+ * 2 TimeZone abbreviation */
} timelib_time;
#define TIMELIB_ZONETYPE_OFFSET 1
now = timelib_time_ctor();
timelib_unixtime2local(now, (timelib_sll) time(NULL), tzi);
} else {
- timelib_tzinfo_ctor(tzi);
+ timelib_tzinfo_dtor(tzi);
RETURN_FALSE;
}