diff options
| author | Ben Straub <bs@github.com> | 2013-09-16 16:12:31 -0700 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-09-16 16:12:31 -0700 |
| commit | 549931679a77b280eb1f36afeda8930eb31d70f7 (patch) | |
| tree | 2744e3e198ad146bae72f35369bbeb4f8028c8c3 /src/date.c | |
| parent | 1a68c168a6cdbe0db6e44fb582a7026a7d536c9d (diff) | |
| parent | 8821c9aa5baf31e21c21825e8c91c765e6631e7f (diff) | |
| download | libgit2-549931679a77b280eb1f36afeda8930eb31d70f7.tar.gz | |
Merge branch 'development' into blame_rebased
Conflicts:
include/git2.h
Diffstat (limited to 'src/date.c')
| -rw-r--r-- | src/date.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/date.c b/src/date.c index 48841e4f9..7849c2f02 100644 --- a/src/date.c +++ b/src/date.c @@ -823,15 +823,13 @@ static void pending_number(struct tm *tm, int *num) } static git_time_t approxidate_str(const char *date, - const struct timeval *tv, - int *error_ret) + time_t time_sec, + int *error_ret) { int number = 0; int touched = 0; struct tm tm = {0}, now; - time_t time_sec; - time_sec = tv->tv_sec; p_localtime_r(&time_sec, &tm); now = tm; @@ -861,7 +859,7 @@ static git_time_t approxidate_str(const char *date, int git__date_parse(git_time_t *out, const char *date) { - struct timeval tv; + time_t time_sec; git_time_t timestamp; int offset, error_ret=0; @@ -870,7 +868,9 @@ int git__date_parse(git_time_t *out, const char *date) return 0; } - p_gettimeofday(&tv, NULL); - *out = approxidate_str(date, &tv, &error_ret); + if (time(&time_sec) == -1) + return -1; + + *out = approxidate_str(date, time_sec, &error_ret); return error_ret; } |
