summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2010-08-30 15:46:22 +0200
committerBjörn Jacke <bj@sernet.de>2010-08-31 10:26:13 +0200
commit0ca6a73d011abd20d8a9256f6dfe3517bd1a27ef (patch)
treeedad269832024d552c9314e13cd7b1911cc695d1 /source3/libsmb
parent5728b0fb5f59f856d2f20a5237dc31a1ca0c4afe (diff)
downloadsamba-0ca6a73d011abd20d8a9256f6dfe3517bd1a27ef.tar.gz
samba-0ca6a73d011abd20d8a9256f6dfe3517bd1a27ef.tar.bz2
samba-0ca6a73d011abd20d8a9256f6dfe3517bd1a27ef.zip
s3: use monotonic clock for time deltas in namequery functions
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index c79480f707..c949d3bcb4 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -261,7 +261,7 @@ NODE_STATUS_STRUCT *node_status_query(int fd,
bool found=False;
int retries = 2;
int retry_time = 2000;
- struct timeval tval;
+ struct timespec tp;
struct packet_struct p;
struct packet_struct *p2;
struct nmb_packet *nmb = &p.packet.nmb;
@@ -297,7 +297,7 @@ NODE_STATUS_STRUCT *node_status_query(int fd,
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
- GetTimeOfDay(&tval);
+ clock_gettime_mono(&tp);
if (!send_packet(&p))
return NULL;
@@ -305,14 +305,14 @@ NODE_STATUS_STRUCT *node_status_query(int fd,
retries--;
while (1) {
- struct timeval tval2;
- GetTimeOfDay(&tval2);
- if (TvalDiff(&tval,&tval2) > retry_time) {
+ struct timespec tp2;
+ clock_gettime_mono(&tp2);
+ if (TspecDiff(&tp,&tp2) > retry_time) {
if (!retries)
break;
if (!found && !send_packet(&p))
return NULL;
- GetTimeOfDay(&tval);
+ clock_gettime_mono(&tp);
retries--;
}
@@ -655,7 +655,7 @@ struct sockaddr_storage *name_query(int fd,
bool found=false;
int i, retries = 3;
int retry_time = bcast?250:2000;
- struct timeval tval;
+ struct timespec tp;
struct packet_struct p;
struct packet_struct *p2;
struct nmb_packet *nmb = &p.packet.nmb;
@@ -705,7 +705,7 @@ struct sockaddr_storage *name_query(int fd,
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
- GetTimeOfDay(&tval);
+ clock_gettime_mono(&tp);
if (!send_packet(&p))
return NULL;
@@ -713,15 +713,15 @@ struct sockaddr_storage *name_query(int fd,
retries--;
while (1) {
- struct timeval tval2;
+ struct timespec tp2;
- GetTimeOfDay(&tval2);
- if (TvalDiff(&tval,&tval2) > retry_time) {
+ clock_gettime_mono(&tp2);
+ if (TspecDiff(&tp,&tp2) > retry_time) {
if (!retries)
break;
if (!found && !send_packet(&p))
return NULL;
- GetTimeOfDay(&tval);
+ clock_gettime_mono(&tp);
retries--;
}