From 5fa89b2cb366d533e56a9b7a9ce548480776f973 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 25 Dec 2014 03:14:09 +0100 Subject: [PATCH] import: prefer usec_t over time_t --- src/import/curl-util.c | 4 ++-- src/import/curl-util.h | 2 +- src/import/import-gpt.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/import/curl-util.c b/src/import/curl-util.c index 78a58a8a6..6a6b1c000 100644 --- a/src/import/curl-util.c +++ b/src/import/curl-util.c @@ -414,7 +414,7 @@ int curl_header_strdup(const void *contents, size_t sz, const char *field, char return 1; } -int curl_parse_http_time(const char *t, time_t *ret) { +int curl_parse_http_time(const char *t, usec_t *ret) { struct tm tm; time_t v; @@ -441,6 +441,6 @@ int curl_parse_http_time(const char *t, time_t *ret) { if (v == (time_t) -1) return -EINVAL; - *ret = v; + *ret = (usec_t) v * USEC_PER_SEC; return 0; } diff --git a/src/import/curl-util.h b/src/import/curl-util.h index b4d75e895..c249069ff 100644 --- a/src/import/curl-util.h +++ b/src/import/curl-util.h @@ -51,7 +51,7 @@ void curl_glue_remove_and_free(CurlGlue *g, CURL *c); struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_; int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value); -int curl_parse_http_time(const char *t, time_t *ret); +int curl_parse_http_time(const char *t, usec_t *ret); DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup); DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all); diff --git a/src/import/import-gpt.c b/src/import/import-gpt.c index eda6dcacb..503f1e64c 100644 --- a/src/import/import-gpt.c +++ b/src/import/import-gpt.c @@ -46,7 +46,7 @@ struct GptImportFile { uint64_t content_length; uint64_t written; - time_t mtime; + usec_t mtime; bool force_local; bool done; @@ -167,7 +167,7 @@ static void gpt_import_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result if (f->mtime != 0) { struct timespec ut[2]; - timespec_store(&ut[0], (usec_t) f->mtime * USEC_PER_SEC); + timespec_store(&ut[0], f->mtime); ut[1] = ut[0]; (void) futimens(f->disk_fd, ut); -- 2.30.2