Beispiel #1
0
unsigned long approxidate_relative(const char *date, const struct timeval *tv)
{
	unsigned long timestamp;
	int offset;
	int errors = 0;

	if (!parse_date_basic(date, &timestamp, &offset))
		return timestamp;
	return approxidate_str(date, tv, &errors);
}
Beispiel #2
0
int git__date_parse(git_time_t *out, const char *date)
{
	struct timeval tv;
	git_time_t timestamp;
	int offset, error_ret=0;

	if (!parse_date_basic(date, &timestamp, &offset)) {
		*out = timestamp;
		return 0;
	}

	p_gettimeofday(&tv, NULL);
	*out = approxidate_str(date, &tv, &error_ret);
   return error_ret;
}
Beispiel #3
0
int approxidate(const char *date, struct timeval *tv)
{
	int offset;

	if (!parse_date_basic(date, tv, &offset)) {
		return 0;
	}

	gettimeofday(tv, NULL);
	if (!approxidate_str(date, tv)) {
		return 0;
	}

	return -1;
}
Beispiel #4
0
unsigned long approxidate_careful(const char *date, int *error_ret)
{
	struct timeval tv;
	unsigned long timestamp;
	int offset;
	int dummy = 0;
	if (!error_ret)
		error_ret = &dummy;

	if (!parse_date_basic(date, &timestamp, &offset)) {
		*error_ret = 0;
		return timestamp;
	}

	gettimeofday(&tv, NULL);
	return approxidate_str(date, &tv, error_ret);
}
Beispiel #5
0
int git__date_parse(git_time_t *out, const char *date)
{
	time_t time_sec;
	git_time_t timestamp;
	int offset, error_ret=0;

	if (!parse_date_basic(date, &timestamp, &offset)) {
		*out = timestamp;
		return 0;
	}

	if (time(&time_sec) == -1)
		return -1;

	*out = approxidate_str(date, time_sec, &error_ret);
   return error_ret;
}