diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-01-25 23:05:24 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-01-30 08:29:59 +0100 |
commit | 8f69a9f28abf98a10a50b3bae5ba319660de82ee (patch) | |
tree | 2b0eea6d076cd97763f0ce5dde7feed742cfe142 /lib/smb.c | |
parent | 9caa3e248da91dc8964328b5b50491ba05df7bd4 (diff) | |
download | curl-8f69a9f28abf98a10a50b3bae5ba319660de82ee.tar.gz |
time: support > year 2038 time stamps for system with 32bit long
... with the introduction of CURLOPT_TIMEVALUE_LARGE and
CURLINFO_FILETIME_T.
Fixes #2238
Closes #2264
Diffstat (limited to 'lib/smb.c')
-rw-r--r-- | lib/smb.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -709,14 +709,19 @@ static CURLcode smb_connection_state(struct connectdata *conn, bool *done) } /* - * Convert a timestamp from the Windows world (100 nsec units from - * 1 Jan 1601) to Posix time. + * Convert a timestamp from the Windows world (100 nsec units from 1 Jan 1601) + * to Posix time. Cap the output to fit within a time_t. */ -static void get_posix_time(long *out, curl_off_t timestamp) +static void get_posix_time(time_t *out, curl_off_t timestamp) { timestamp -= 116444736000000000; timestamp /= 10000000; - *out = (long) timestamp; + if(timestamp > TIME_T_MAX) + *out = TIME_T_MAX; + else if(timestamp < TIME_T_MIN) + *out = TIME_T_MIN; + else + *out = (time_t) timestamp; } static CURLcode smb_request_state(struct connectdata *conn, bool *done) |