diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2013-08-19 16:44:17 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2013-08-19 16:44:17 -0500 |
| commit | 86967cc579ee9e8c1a209a76c12605dd24dcf6cf (patch) | |
| tree | d7c1318f8fc0644279837d69cb32ed5998c957fb /src/date.c | |
| parent | 6d69fbce31c391c7a7739f8156b0d63f399c53bf (diff) | |
| download | libgit2-86967cc579ee9e8c1a209a76c12605dd24dcf6cf.tar.gz | |
Use time(2) to get the time
We didn't use the added precision in gettimeofday, so remove it.
This prevents us from having an unnecessary reimplementation on
win32.
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; } |
