not build it.
Linux build fixes.
*/
time_t dateparse(const char *s);
*/
time_t dateparse(const char *s);
struct tm *xgetdate(const char *string,
const char *const *template);
struct tm *xgetdate(const char *string,
const char *const *template);
int xgetdate_r(const char *string,
struct tm *tp,
const char *const *template);
int xgetdate_r(const char *string,
struct tm *tp,
const char *const *template);
#include "dateparse.h"
static void check_date(time_t when,
#include "dateparse.h"
static void check_date(time_t when,
struct tm *(*convert)(const time_t *)) {
char buffer[128];
time_t parsed;
struct tm *(*convert)(const time_t *)) {
char buffer[128];
time_t parsed;
- strftime(buffer, sizeof buffer, format, convert(&when));
+ strftime(buffer, sizeof buffer, fmt, convert(&when));
parsed = dateparse(buffer);
check_integer(parsed, when);
if(parsed != when)
parsed = dateparse(buffer);
check_integer(parsed, when);
if(parsed != when)
- fprintf(stderr, "format=%s formatted=%s\n", format, buffer);
+ fprintf(stderr, "format=%s formatted=%s\n", fmt, buffer);
}
static void test_dateparse(void) {
}
static void test_dateparse(void) {
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define _GNU_SOURCE 1 /* to expose strptime */
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
8 invalid input specification Example: February 31 or a time is
specified that can not be represented in a time_t (representing
the time in seconds since 00:00:00 UTC, January 1, 1970) */
8 invalid input specification Example: February 31 or a time is
specified that can not be represented in a time_t (representing
the time in seconds since 00:00:00 UTC, January 1, 1970) */
/* Returns the first weekday WDAY of month MON in the year YEAR. */
/* Returns the first weekday WDAY of month MON in the year YEAR. */
struct tm *
xgetdate (const char *string, const char *const *template)
{
struct tm *
xgetdate (const char *string, const char *const *template)
{
return NULL;
}
return &tmbuf;
}
return NULL;
}
return &tmbuf;
}