diff options
author | Björn Jacke <bj@sernet.de> | 2010-08-31 13:10:45 +0200 |
---|---|---|
committer | Björn Jacke <bj@sernet.de> | 2010-08-31 13:10:45 +0200 |
commit | b4ae2efa963649c46fa4a3e3ad054c691f38af5b (patch) | |
tree | 0dfd43d8c06cd46de38075863dd7d77ff36ddc30 /source3 | |
parent | 20254221d2c935ebcf2c4ea4372b1634bd09b1f0 (diff) | |
download | samba-b4ae2efa963649c46fa4a3e3ad054c691f38af5b.tar.gz samba-b4ae2efa963649c46fa4a3e3ad054c691f38af5b.tar.bz2 samba-b4ae2efa963649c46fa4a3e3ad054c691f38af5b.zip |
s3: use monotonic clock for time deltas in smbget
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/smbget.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c index 62ecb34c9e..85bbd245a6 100644 --- a/source3/utils/smbget.c +++ b/source3/utils/smbget.c @@ -276,7 +276,7 @@ static int smb_download_file(const char *base, const char *name, int recursive, int resume, int toplevel, char *outfile) { int remotehandle, localhandle; - time_t start_time = time(NULL); + struct timespec start_time, now; const char *newpath; char path[SMB_MAXPATHLEN]; char checkbuf[2][RESUME_CHECK_SIZE]; @@ -284,6 +284,7 @@ static int smb_download_file(const char *base, const char *name, int recursive, off_t offset_download = 0, offset_check = 0, curpos = 0, start_offset = 0; struct stat localstat, remotestat; + clock_gettime_mono(&start_time); snprintf(path, SMB_MAXPATHLEN-1, "%s%s%s", base, (*base && *name && name[0] != '/' && base[strlen(base)-1] != '/')?"/":"", name); remotehandle = smbc_open(path, O_RDONLY, 0755); @@ -466,7 +467,9 @@ static int smb_download_file(const char *base, const char *name, int recursive, if(dots)fputc('.', stderr); else if(!quiet) { - print_progress(newpath, start_time, time(NULL), start_offset, curpos, remotestat.st_size); + clock_gettime_mono(&now); + print_progress(newpath, start_time.tv_sec, now.tv_sec, + start_offset, curpos, remotestat.st_size); } } |